package com.cqupt.scanning.system.file.helper;

import cn.hutool.core.util.NumberUtil;
import com.cqupt.scanning.system.admin.entity.CopLeftFoot;
import com.cqupt.scanning.system.admin.entity.CopRightFoot;
import com.cqupt.scanning.system.admin.entity.FeatureData;
import static com.cqupt.scanning.system.file.helper.fft.FFT.fft;
import com.cqupt.scanning.system.file.helper.fft.Complex;

import org.apache.poi.sl.usermodel.PaintStyle;
import org.jfree.chart.*;
import org.jfree.chart.axis.*;
import org.jfree.chart.labels.ItemLabelAnchor;
import org.jfree.chart.labels.ItemLabelPosition;
import org.jfree.chart.labels.StandardCategoryItemLabelGenerator;
import org.jfree.chart.labels.StandardPieSectionLabelGenerator;
import org.jfree.chart.plot.*;

import org.jfree.chart.renderer.category.BarRenderer;
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
import org.jfree.chart.title.LegendTitle;
import org.jfree.chart.title.TextTitle;
import org.jfree.data.RangeType;
import org.jfree.data.category.DefaultCategoryDataset;
import org.jfree.data.general.DefaultPieDataset;
import org.jfree.data.xy.DefaultXYDataset;
import org.jfree.ui.TextAnchor;
import org.jfree.util.Rotation;

import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.geom.Ellipse2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.*;
import java.util.List;

/**
 * 生成图片类
 * @Data: 2021/7/7 13:32
 * @Author: 宋宝梁
 */
public class GenerateImage {

    private String tempImageDir;
    private Map<String, Object> pictureData;

    public GenerateImage(String tempImageDir) {
        this.tempImageDir = tempImageDir;
    }

    public void generateAllPictures(FeatureData featureData, CopLeftFoot copLeftFoot, CopRightFoot copRightFoot,
                                    List<String[]> csvListLeft, List<String[]> csvListRight, Map<String, Object> pictureData) {
        this.pictureData = pictureData;
        markTriangle();
        dynamicRectangleLeft(featureData, 1925, 82);
        dynamicRectangleRight(featureData, 1925, 82);
        MaxFPAleft(featureData, 1925, 82);
        MaxFPAright(featureData, 1925, 82);
        MinFPAleft(featureData, 1925, 82);
        MinFPAright(featureData, 1925, 82);

        generateHistogram(featureData, 2198, 1048);
//        generateCopChart(copLeftFoot, copRightFoot, 834, 654);

        generateBalance(csvListLeft, csvListRight, 1200, 1200);
//        generateBalance_other(csvListLeft, csvListRight, 1200, 1200);
//        generateOffsetOne(csvListLeft, csvListRight, 1200, 1200);
//        generateOffsetOne_other(csvListLeft, csvListRight, 1200, 1200);
//        generateOffsetTwo(csvListLeft, csvListRight, 1200, 1200);
        generateAveragePercentage(featureData, 507, 507);
        generateAveragePressure(featureData, 507, 507);
        generateleftOffset(featureData, 428, 428);
        generaterightOffset(featureData, 428, 428);
        generateForeFoot(featureData, 428, 428);
        generateHindFoot(featureData, 428, 428);
        generateMidFoot(featureData, 428, 428);
        generateLeftForeHind(featureData, 428, 428);
        generateRightForeHind(featureData, 428, 428);
        generateForeHind(featureData, 428, 428);
        generateOtherForeFoot(featureData, 428, 428);
        generateOtherHindFoot(featureData, 428, 428);
        generateInsideImage(featureData, 428, 428);
        generateOutsideImage(featureData, 428, 428);
        generateInOutLeft(featureData, 428, 428);
        generateInOutRight(featureData, 428, 428);
        generateInOut(featureData, 428, 428);
        generateFFT(csvListLeft, csvListRight,650,420);
        generateForeMidHindPercentage(featureData, 428, 428);
        generateWeightPercentageLeft(featureData, 500, 500);
        generateWeightPercentageRight(featureData, 500, 500);
    }

    /**
     * 生成三角形标记符号
     */
    private boolean markTriangle() {

        final int areaW = 50; // 图片宽
        final int areaH = 50; // 图片高

        for (int i=0; i<2; i++) {
            BufferedImage bi = new BufferedImage(areaW, areaH, BufferedImage.TYPE_INT_RGB); // INT精确度达到一定,RGB三原色
            Graphics2D g2 = (Graphics2D) bi.getGraphics(); // 得到它的绘制环境(这张图片的笔)
            Color bgColor = new Color(255, 255, 255);
            g2.setColor(bgColor); // 设置背景颜色
            g2.fillRect(0, 0, areaW, areaH);// 填充整张图片(其实就是设置背景颜色)
            if(i==0) {
                g2.setColor(Color.decode("#56CA95"));
//                //绘制圆形
//                //圆心x，圆心y，宽度，高度
//                g2.fillOval(25,25,24,24);  //实心圆
                int[] x = {25, 0, 49};
                int[] y = {0, 49, 49};
                g2.fillPolygon(x,y,3);
                g2.dispose(); // 释放对象
                try {
                    File file = new File(this.tempImageDir);
                    if (!file.exists()) file.mkdir();
                    String imageLeftName = this.tempImageDir + File.separator + "triangle" + i + ".jpg";
                    ImageIO.write(bi, "JPEG", new FileOutputStream(imageLeftName)); // 保存图片
                } catch (IOException e) {
                    e.printStackTrace();
                    return false;
                }
            } else {
                g2.setColor(Color.decode("#EC5F74"));
                int[] x = {25, 0, 49};
                int[] y = {0, 49, 49};
                g2.fillPolygon(x,y,3);
                g2.dispose(); // 释放对象
                try {
                    File file = new File(this.tempImageDir);
                    if (!file.exists()) file.mkdir();
                    String imageLeftName = this.tempImageDir + File.separator + "triangle" + i + ".jpg";
                    ImageIO.write(bi, "JPEG", new FileOutputStream(imageLeftName)); // 保存图片
                } catch (IOException e) {
                    return false;
                }
            }
        }
        return true;
    }

    /**
     * 生成左脚步态周期检测图
     * @param featureData
     */
    private boolean dynamicRectangleLeft(FeatureData featureData, int width, int height) {
        try {
            pictureData.put("loading_ratio_left_mean", featureData.getLoadingRatioLeftMean());
            pictureData.put("footFlat_ratio_left_mean", featureData.getFootflatRatioLeftMean());
            pictureData.put("pre_swing_ratio_left_mean", featureData.getPreSwingRatioLeftMean());
            pictureData.put("swing_ratio_left_mean", featureData.getSwingRatioLeftMean());

            double l1 = Double.parseDouble(featureData.getLoadingRatioLeftMean());
            double l2 = Double.parseDouble(featureData.getFootflatRatioLeftMean());
            double l3 = Double.parseDouble(featureData.getPreSwingRatioLeftMean());
            double l4 = Double.parseDouble(featureData.getSwingRatioLeftMean());

            int w1 = (int) NumberUtil.round(width * l1, 0).floatValue();
            int w2 = (int) NumberUtil.round(width * l2, 0).floatValue();
            int w3 = (int) NumberUtil.round(width * l3, 0).floatValue();
            int w4 = (int) NumberUtil.round(width * l4, 0).floatValue();

            // 得到图片缓冲区
            BufferedImage bi = new BufferedImage( width, height, BufferedImage.TYPE_INT_RGB);

            // 得到它的绘制环境(这张图片的笔)
            Graphics2D g2 = (Graphics2D) bi.getGraphics();

            Color color1 = new Color(216, 197, 65);
            g2.setColor(color1);
            g2.fillRect(0, 0, w1, height);

            Color color2 = new Color(128, 192, 70);
            g2.setColor(color2);
            g2.fillRect(w1, 0, w2, height);

            Color color3 = new Color(63, 148, 209);
            g2.setColor(color3);
            g2.fillRect(w1+w2,0, w3, height);

            Color color4 = new Color(154, 107, 171);
            g2.setColor(color4);
            g2.fillRect(w1+w2+w3, 0, w4, height);

            // 图片中写字
            g2.setColor(Color.WHITE);
            g2.setFont(new Font("黑体", Font.BOLD, 30));
            g2.drawString(NumberUtil.round(l1, 2).multiply(new BigDecimal(100)).intValue() + "%", (w1/2)-20,height/2 );
            g2.drawString(NumberUtil.round(l2, 2).multiply(new BigDecimal(100)).intValue() + "%", (w1+w2/2)-10,height/2 );
            g2.drawString(NumberUtil.round(l3, 2).multiply(new BigDecimal(100)).intValue() + "%", (w1+w2+w3/2)-10,height/2 );
            g2.drawString((NumberUtil.round(1,2).subtract(NumberUtil.round(l1,2)).subtract(NumberUtil.round(l2,2)).subtract(NumberUtil.round(l3,2)))
                             .multiply(new BigDecimal(100)).intValue() + "%", (w1+w2+w3+w4/2)-10,height/2 );

            g2.dispose(); // 释放对象

            File file = new File(this.tempImageDir);
            if (!file.exists()) file.mkdir();
            String imageLeftName = this.tempImageDir + File.separator + "l.jpg";
            ImageIO.write(bi, "JPEG", new FileOutputStream(imageLeftName)); // 保存图片
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }

    /**
     * 生成右脚步态周期检测图
     * @param featureData
     * @param width
     * @param height
     */
    private boolean dynamicRectangleRight(FeatureData featureData, int width, int height) {
        try {
            pictureData.put("loading_ratio_right_mean", featureData.getLoadingRatioRightMean());
            pictureData.put("footFlat_ratio_right_mean", featureData.getFootflatRatioRightMean());
            pictureData.put("pre_swing_ratio_right_mean", featureData.getPreSwingRatioRightMean());
            pictureData.put("swing_ratio_right_mean", featureData.getSwingRatioRightMean());

            double l1 = Double.parseDouble(featureData.getLoadingRatioRightMean());
            double l2 = Double.parseDouble(featureData.getFootflatRatioRightMean());
            double l3 = Double.parseDouble(featureData.getPreSwingRatioRightMean());
            double l4 = Double.parseDouble(featureData.getSwingRatioRightMean());

            int w1 = (int) NumberUtil.round(width * l1, 0).floatValue();
            int w2 = (int) NumberUtil.round(width * l2, 0).floatValue();
            int w3 = (int) NumberUtil.round(width * l3, 0).floatValue();
            int w4 = (int) NumberUtil.round(width * l4, 0).floatValue();

            // 得到图片缓冲区
            BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);

            // 得到它的绘制环境(这张图片的笔)
            Graphics2D g2 = (Graphics2D) bi.getGraphics();

            Color color1 = new Color(216, 197, 65);
            g2.setColor(color1);
            g2.fillRect(0, 0, w1, height);

            Color color2 = new Color(128, 192, 70);
            g2.setColor(color2);
            g2.fillRect(w1, 0, w2, height);

            Color color3 = new Color(63, 148, 209);
            g2.setColor(color3);
            g2.fillRect(w1+w2,0, w3, height);

            Color color4 = new Color(154, 107, 171);
            g2.setColor(color4);
            g2.fillRect(w1+w2+w3, 0, w4, height);

            // 图片中写字
            g2.setColor(Color.WHITE);
            g2.setFont(new Font("黑体", Font.BOLD, 30));
            g2.drawString(NumberUtil.round(l1, 2).multiply(new BigDecimal(100)).intValue() + "%", (w1/2)-20,height/2 );
            g2.drawString(NumberUtil.round(l2, 2).multiply(new BigDecimal(100)).intValue() + "%", (w1+w2/2)-10,height/2 );
            g2.drawString(NumberUtil.round(l3, 2).multiply(new BigDecimal(100)).intValue() + "%", (w1+w2+w3/2)-10,height/2 );
            g2.drawString((NumberUtil.round(1,2).subtract(NumberUtil.round(l1,2)).subtract(NumberUtil.round(l2,2)).subtract(NumberUtil.round(l3,2)))
                    .multiply(new BigDecimal(100)).intValue() + "%", (w1+w2+w3+w4/2)-10,height/2 );

            g2.dispose(); // 释放对象

            File file = new File(this.tempImageDir);
            if (!file.exists()) file.mkdir();
            String imageLeftName = this.tempImageDir + File.separator + "r.jpg";
            ImageIO.write(bi, "JPEG", new FileOutputStream(imageLeftName));
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }

    /**
     * 生成左脚步态最大步偏角
     * @param featureData
     * @param width
     * @param height
     */
    private boolean MaxFPAleft(FeatureData featureData, int width, int height) {
        try {
            double l1 = Double.parseDouble(featureData.getLoadingRatioLeftMean());
            double l2 = Double.parseDouble(featureData.getFootflatRatioLeftMean());
            double l3 = Double.parseDouble(featureData.getPreSwingRatioLeftMean());
            double l4 = Double.parseDouble(featureData.getSwingRatioLeftMean());


            int w1 = (int) NumberUtil.round(width * l1, 0).floatValue();
            int w2 = (int) NumberUtil.round(width * l2, 0).floatValue();
            int w3 = (int) NumberUtil.round(width * l3, 0).floatValue();
            int w4 = (int) NumberUtil.round(width * l4, 0).floatValue();


            // 得到图片缓冲区
            BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);

            // 得到它的绘制环境(这张图片的笔)
            Graphics2D g2 = (Graphics2D) bi.getGraphics();

            Color color1 = new Color(216, 197, 65);
            g2.setColor(color1);
            g2.fillRect(0, 0, w1, height);

            Color color2 = new Color(128, 192, 70);
            g2.setColor(color2);
            g2.fillRect(w1, 0, w2, height);

            Color color3 = new Color(63, 148, 209);
            g2.setColor(color3);
            g2.fillRect(w1+w2,0, w3, height);

            Color color4 = new Color(154, 107, 171);
            g2.setColor(color4);
            g2.fillRect(w1+w2+w3, 0, w4, height);

            // 图片中写字
            g2.setColor(Color.WHITE);
            g2.setFont(new Font("黑体", Font.BOLD, 30));
            g2.drawString(NumberUtil.round(l1, 2).multiply(new BigDecimal(100)).intValue() + "%", (w1/2)-20,height/2 );
            g2.drawString(NumberUtil.round(l2, 2).multiply(new BigDecimal(100)).intValue() + "%", (w1+w2/2)-10,height/2 );
            g2.drawString(NumberUtil.round(l3, 2).multiply(new BigDecimal(100)).intValue() + "%", (w1+w2+w3/2)-10,height/2 );
            g2.drawString((NumberUtil.round(1,2).subtract(NumberUtil.round(l1,2)).subtract(NumberUtil.round(l2,2)).subtract(NumberUtil.round(l3,2)))
                             .multiply(new BigDecimal(100)).intValue() + "%", (w1+w2+w3+w4/2)-10,height/2 );

            g2.dispose(); // 释放对象

            File file = new File(this.tempImageDir);
            if (!file.exists()) file.mkdir();
            String imageLeftName = this.tempImageDir + File.separator + "MaxFPAleft.jpg";
            ImageIO.write(bi, "JPEG", new FileOutputStream(imageLeftName)); // 保存图片
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }

    /**
     * 生成右脚步态最大步偏角
     * @param featureData
     * @param width
     * @param height
     */
    private boolean MaxFPAright(FeatureData featureData, int width, int height) {
        try {
            double l1 = Double.parseDouble(featureData.getLoadingRatioRightMean());
            double l2 = Double.parseDouble(featureData.getFootflatRatioRightMean());
            double l3 = Double.parseDouble(featureData.getPreSwingRatioRightMean());
            double l4 = Double.parseDouble(featureData.getSwingRatioRightMean());

            int w1 = (int) NumberUtil.round(width * l1, 0).floatValue();
            int w2 = (int) NumberUtil.round(width * l2, 0).floatValue();
            int w3 = (int) NumberUtil.round(width * l3, 0).floatValue();
            int w4 = (int) NumberUtil.round(width * l4, 0).floatValue();

            // 得到图片缓冲区
            BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);

            // 得到它的绘制环境(这张图片的笔)
            Graphics2D g2 = (Graphics2D) bi.getGraphics();

            Color color1 = new Color(216, 197, 65);
            g2.setColor(color1);
            g2.fillRect(0, 0, w1, height);

            Color color2 = new Color(128, 192, 70);
            g2.setColor(color2);
            g2.fillRect(w1, 0, w2, height);

            Color color3 = new Color(63, 148, 209);
            g2.setColor(color3);
            g2.fillRect(w1+w2,0, w3, height);

            Color color4 = new Color(154, 107, 171);
            g2.setColor(color4);
            g2.fillRect(w1+w2+w3, 0, w4, height);

            // 图片中写字
            g2.setColor(Color.WHITE);
            g2.setFont(new Font("黑体", Font.BOLD, 30));
            g2.drawString(NumberUtil.round(l1, 2).multiply(new BigDecimal(100)).intValue() + "%", (w1/2)-20,height/2 );
            g2.drawString(NumberUtil.round(l2, 2).multiply(new BigDecimal(100)).intValue() + "%", (w1+w2/2)-10,height/2 );
            g2.drawString(NumberUtil.round(l3, 2).multiply(new BigDecimal(100)).intValue() + "%", (w1+w2+w3/2)-10,height/2 );
            g2.drawString((NumberUtil.round(1,2).subtract(NumberUtil.round(l1,2)).subtract(NumberUtil.round(l2,2)).subtract(NumberUtil.round(l3,2)))
                             .multiply(new BigDecimal(100)).intValue() + "%", (w1+w2+w3+w4/2)-10,height/2 );

            g2.dispose(); // 释放对象

            File file = new File(this.tempImageDir);
            if (!file.exists()) file.mkdir();
            String imageLeftName = this.tempImageDir + File.separator + "MaxFPAright.jpg";
            ImageIO.write(bi, "JPEG", new FileOutputStream(imageLeftName));
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }

    /**
     * 生成左脚步态最小步偏角
     * @param featureData
     * @param width
     * @param height
     */
    private boolean MinFPAleft(FeatureData featureData, int width, int height) {
        try {
            double l1 = Double.parseDouble(featureData.getLoadingRatioLeftMean());
            double l2 = Double.parseDouble(featureData.getFootflatRatioLeftMean());
            double l3 = Double.parseDouble(featureData.getPreSwingRatioLeftMean());
            double l4 = Double.parseDouble(featureData.getSwingRatioLeftMean());

            int w1 = (int) NumberUtil.round(width * l1, 0).floatValue();
            int w2 = (int) NumberUtil.round(width * l2, 0).floatValue();
            int w3 = (int) NumberUtil.round(width * l3, 0).floatValue();
            int w4 = (int) NumberUtil.round(width * l4, 0).floatValue();

            // 得到图片缓冲区
            BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);

            // 得到它的绘制环境(这张图片的笔)
            Graphics2D g2 = (Graphics2D) bi.getGraphics();

            Color color1 = new Color(216, 197, 65);
            g2.setColor(color1);
            g2.fillRect(0, 0, w1, height);

            Color color2 = new Color(128, 192, 70);
            g2.setColor(color2);
            g2.fillRect(w1, 0, w2, height);

            Color color3 = new Color(63, 148, 209);
            g2.setColor(color3);
            g2.fillRect(w1+w2,0, w3, height);

            Color color4 = new Color(154, 107, 171);
            g2.setColor(color4);
            g2.fillRect(w1+w2+w3, 0, w4, height);

            // 图片中写字
            g2.setColor(Color.WHITE);
            g2.setFont(new Font("黑体", Font.BOLD, 30));
            g2.drawString(NumberUtil.round(l1, 2).multiply(new BigDecimal(100)).intValue() + "%", (w1/2)-20,height/2 );
            g2.drawString(NumberUtil.round(l2, 2).multiply(new BigDecimal(100)).intValue() + "%", (w1+w2/2)-10,height/2 );
            g2.drawString(NumberUtil.round(l3, 2).multiply(new BigDecimal(100)).intValue() + "%", (w1+w2+w3/2)-10,height/2 );
            g2.drawString(NumberUtil.round(l4, 2).multiply(new BigDecimal(100)).intValue() + "%", (w1+w2+w3+w4/2)-10,height/2 );

            g2.dispose(); // 释放对象

            File file = new File(this.tempImageDir);
            if (!file.exists()) file.mkdir();
            String imageLeftName = this.tempImageDir + File.separator + "MinFPAleft.jpg";
            ImageIO.write(bi, "JPEG", new FileOutputStream(imageLeftName)); // 保存图片
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }

    /**
     * 生成右脚步态最小步偏角
     * @param featureData
     * @param width
     * @param height
     */
    private boolean MinFPAright(FeatureData featureData, int width, int height) {
        try {
            double l1 = Double.parseDouble(featureData.getLoadingRatioRightMean());
            double l2 = Double.parseDouble(featureData.getFootflatRatioRightMean());
            double l3 = Double.parseDouble(featureData.getPreSwingRatioRightMean());
            double l4 = Double.parseDouble(featureData.getSwingRatioRightMean());

            int w1 = (int) NumberUtil.round(width * l1, 0).floatValue();
            int w2 = (int) NumberUtil.round(width * l2, 0).floatValue();
            int w3 = (int) NumberUtil.round(width * l3, 0).floatValue();
            int w4 = (int) NumberUtil.round(width * l4, 0).floatValue();

            // 得到图片缓冲区
            BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);

            // 得到它的绘制环境(这张图片的笔)
            Graphics2D g2 = (Graphics2D) bi.getGraphics();

            Color color1 = new Color(216, 197, 65);
            g2.setColor(color1);
            g2.fillRect(0, 0, w1, height);

            Color color2 = new Color(128, 192, 70);
            g2.setColor(color2);
            g2.fillRect(w1, 0, w2, height);

            Color color3 = new Color(63, 148, 209);
            g2.setColor(color3);
            g2.fillRect(w1+w2,0, w3, height);

            Color color4 = new Color(154, 107, 171);
            g2.setColor(color4);
            g2.fillRect(w1+w2+w3, 0, w4, height);

            // 图片中写字
            g2.setColor(Color.WHITE);
            g2.setFont(new Font("黑体", Font.BOLD, 30));
            g2.drawString(NumberUtil.round(l1, 2).multiply(new BigDecimal(100)).intValue() + "%", (w1/2)-20,height/2 );
            g2.drawString(NumberUtil.round(l2, 2).multiply(new BigDecimal(100)).intValue() + "%", (w1+w2/2)-10,height/2 );
            g2.drawString(NumberUtil.round(l3, 2).multiply(new BigDecimal(100)).intValue() + "%", (w1+w2+w3/2)-10,height/2 );
            g2.drawString(NumberUtil.round(l4, 2).multiply(new BigDecimal(100)).intValue() + "%", (w1+w2+w3+w4/2)-10,height/2 );

            g2.dispose(); // 释放对象

            File file = new File(this.tempImageDir);
            if (!file.exists()) file.mkdir();
            String imageLeftName = this.tempImageDir + File.separator + "MinFPAright.jpg";
            ImageIO.write(bi, "JPEG", new FileOutputStream(imageLeftName));
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }

    /**
     * 生成左脚右脚压力值图(柱状图)   "pressure.jpg"
     * @param featureData
     * @param width
     * @param height
     */
    private boolean generateHistogram(FeatureData featureData, int width, int height) {
        FileOutputStream fos = null;
        try {
            List<String> leftPressureList = new ArrayList<>();
            leftPressureList.add(featureData.getPressureMeanLeft1());
            leftPressureList.add(featureData.getPressureMeanLeft2());
            leftPressureList.add(featureData.getPressureMeanLeft3());
            leftPressureList.add(featureData.getPressureMeanLeft4());
            leftPressureList.add(featureData.getPressureMeanLeft5());
            leftPressureList.add(featureData.getPressureMeanLeft6());
            leftPressureList.add(featureData.getPressureMeanLeft7());
            leftPressureList.add(featureData.getPressureMeanLeft8());
            leftPressureList.add(featureData.getPressureMeanLeft9());
            pictureData.put("pressure_mean_left_one", featureData.getPressureMeanLeft1());
            pictureData.put("pressure_mean_left_two", featureData.getPressureMeanLeft2());
            pictureData.put("pressure_mean_left_three", featureData.getPressureMeanLeft3());
            pictureData.put("pressure_mean_left_four", featureData.getPressureMeanLeft4());
            pictureData.put("pressure_mean_left_five", featureData.getPressureMeanLeft5());
            pictureData.put("pressure_mean_left_six", featureData.getPressureMeanLeft6());
            pictureData.put("pressure_mean_left_seven", featureData.getPressureMeanLeft7());
            pictureData.put("pressure_mean_left_eight", featureData.getPressureMeanLeft8());
            pictureData.put("pressure_mean_left_nine", featureData.getPressureMeanLeft9());

            List<String> rightPressureList = new ArrayList<>();
            rightPressureList.add(featureData.getPressureMeanRigh1());
            rightPressureList.add(featureData.getPressureMeanRight2());
            rightPressureList.add(featureData.getPressureMeanRight3());
            rightPressureList.add(featureData.getPressureMeanRight4());
            rightPressureList.add(featureData.getPressureMeanRight5());
            rightPressureList.add(featureData.getPressureMeanRight6());
            rightPressureList.add(featureData.getPressureMeanRight7());
            rightPressureList.add(featureData.getPressureMeanRight8());
            rightPressureList.add(featureData.getPressureMeanRight9());
            pictureData.put("pressure_mean_right_one", featureData.getPressureMeanRigh1());
            pictureData.put("pressure_mean_right_two", featureData.getPressureMeanRight2());
            pictureData.put("pressure_mean_right_three", featureData.getPressureMeanRight3());
            pictureData.put("pressure_mean_right_four", featureData.getPressureMeanRight4());
            pictureData.put("pressure_mean_right_five", featureData.getPressureMeanRight5());
            pictureData.put("pressure_mean_right_six", featureData.getPressureMeanRight6());
            pictureData.put("pressure_mean_right_seven", featureData.getPressureMeanRight7());
            pictureData.put("pressure_mean_right_eight", featureData.getPressureMeanRight8());
            pictureData.put("pressure_mean_right_nine", featureData.getPressureMeanRight9());

            DefaultCategoryDataset dateSet = new DefaultCategoryDataset();

            for (int i=1; i<=9; i++) {
                if(getTwoDigits(leftPressureList.get(i-1)) == null || getTwoDigits(rightPressureList.get(i-1)) == null) {
                    continue;
                }
                dateSet.setValue(getTwoDigits(leftPressureList.get(i-1)), "左脚", "区域"+i);
                dateSet.setValue(getTwoDigits(rightPressureList.get(i-1)), "右脚", "区域"+i);
            }

            JFreeChart chart = ChartFactory.createBarChart(null, //标题
                    null, //目录轴的显示标签
                    "平均压力值", //数值的显示标签
                    dateSet, //数据
                    PlotOrientation.VERTICAL, //图标方向  水平/垂直
                    false,  //是否显示图例
                    false, //是否生成工具
                    false); //是否生成URL链接

//            LegendTitle legend = chart.getLegend();
//            legend.setItemFont(new Font("黑体",Font.BOLD,20));

            CategoryPlot categoryPlot = chart.getCategoryPlot();//图部分
            categoryPlot.setBackgroundPaint(ChartColor.WHITE); // 设置图的背景颜色

            CategoryAxis domainAxis = categoryPlot.getDomainAxis();//X轴
            domainAxis.setCategoryLabelPositions(CategoryLabelPositions.STANDARD);//X轴下标  90°显示
            domainAxis.setMaximumCategoryLabelLines(10);//自动换行    最多显示多少行
            domainAxis.setLabelFont(new Font("黑体",Font.BOLD,20));//下标
            domainAxis.setTickLabelFont(new Font("宋体",Font.BOLD,20));//X轴标题

            ValueAxis rangeAxis = categoryPlot.getRangeAxis();//Y轴
            rangeAxis.setLabelFont(new Font("黑体",Font.BOLD,20));//下标
            rangeAxis.setTickLabelFont(new Font("宋体",Font.BOLD,20));//Y轴标题

            NumberAxis numberAxis = (NumberAxis) categoryPlot.getRangeAxis();
            numberAxis.setAutoTickUnitSelection(true); //自动设置Y轴刻度
            numberAxis.setAutoRangeStickyZero(true);
            numberAxis.setRangeType(RangeType.POSITIVE);
            numberAxis.setNumberFormatOverride(new DecimalFormat("#"));//设置Y轴上的数值精度

            BarRenderer renderer = (BarRenderer) categoryPlot.getRenderer();//图形修改
            renderer.setItemMargin(0);//设置柱子之间的距离
            renderer.setPositiveItemLabelPositionFallback(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER));
            renderer.setDrawBarOutline(false);
            renderer.setMaximumBarWidth(0.3); //设置柱子宽度
            renderer.setMinimumBarLength(0.00); //设置柱子高度

            renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); // 设置数值显示
            renderer.setBaseItemLabelsVisible(true);
            renderer.setBaseItemLabelFont(new Font("黑体",Font.BOLD,20));
            renderer.setBaseItemLabelPaint(ChartColor.BLACK);
            renderer.setSeriesPaint(0, Color.decode("#EC5F74")); // 设置柱子的颜色
            renderer.setSeriesPaint(1, Color.decode("#56CA95"));  // 设置柱子的颜色

            File file = new File(this.tempImageDir);
            if (!file.exists()) file.mkdir(); // 创建文件夹
            String pressureImagePath = this.tempImageDir + File.separator + "pressure.jpg";
            fos = new FileOutputStream(pressureImagePath);
            ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        } finally {
            try {
                if (fos!=null) fos.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }

    /**
     * 生成cop坐标图(散点图)
     * @param copLeftFoot
     * @param copRightFoot
     * @param width
     * @param height
     */
    private boolean generateCopChart(CopLeftFoot copLeftFoot, CopRightFoot copRightFoot, int width, int height) {
        FileOutputStream fos = null;
        try {
            DefaultXYDataset xydataset = new DefaultXYDataset();

            Map<String, Map<Integer, List<String>>> map = new HashMap<>();

            Map<Integer, List<String>> xyMapLeft = new HashMap<>();
            Map<Integer, List<String>> xyMapRight = new HashMap<>();

            // 左脚(x,y)坐标
            List<String> xListLeft = copLeftFoot.getXData();
            List<String> yListLeft = copLeftFoot.getYData();
            pictureData.put("cop_x_left", xListLeft);
            pictureData.put("cop_y_left", yListLeft);

            // 右脚(x,y)坐标
            List<String> xListRight = copRightFoot.getXData();
            List<String> yListRight = copRightFoot.getYData();
            pictureData.put("cop_x_right", xListRight);
            pictureData.put("cop_y_right", yListRight);

            xyMapLeft.put(0, xListLeft);
            xyMapLeft.put(1, yListLeft);
            xyMapRight.put(0, xListRight);
            xyMapRight.put(1, yListRight);

            map.put("左脚", xyMapLeft);
            map.put("右脚", xyMapRight);

            //根据类别建立数据集
            for (Map.Entry<String,Map<Integer, List<String>>> entry : map.entrySet()) {
                Map<Integer, List<String>> entryValue = entry.getValue();
                int size = entryValue.get(0).size();
                //散点图要求数据集为二维数组
                double[][] datas = new double[2][size];
                for (int i = 0; i < size; i++) {
                    String xData = entryValue.get(0).get(i);
                    String yData = entryValue.get(1).get(i);
                    Double x = getFourDigits(xData);
                    Double y = getFourDigits(yData);
                    // 忽略坐标有null或者空字符串的情况
                    if(x==null || y==null) {
                        continue;
                    }
                    datas[0][i] = x;
                    datas[1][i] = y;
                }
                xydataset.addSeries(entry.getKey(), datas);
            }

            JFreeChart chart = ChartFactory.createScatterPlot(null, "X", "Y",
                    xydataset, PlotOrientation.VERTICAL, true, false, false);

            chart.setBackgroundPaint(Color.white);
            chart.setBorderPaint(Color.GREEN);
            chart.setBorderStroke(new BasicStroke(1.5f));

            LegendTitle legend = chart.getLegend(); // 图例
            legend.setItemFont(new Font("黑体", Font.BOLD, 20));

            XYPlot xyplot = (XYPlot) chart.getPlot();
            xyplot.setBackgroundPaint(new Color(255, 253, 246));
            xyplot.setOutlineStroke(new BasicStroke(1.5f)); // 边框粗细

            ValueAxis xAxis = xyplot.getDomainAxis();
            xAxis.setAxisLineStroke(new BasicStroke(1.5f));
            xAxis.setAxisLineStroke(new BasicStroke(1.5f));
            xAxis.setAxisLineStroke(new BasicStroke(1.5f)); // 坐标轴粗细
            xAxis.setAxisLinePaint(new Color(215, 215, 215)); // 坐标轴颜色
            xAxis.setLabelPaint(new Color(10, 10, 10)); // 坐标轴标题颜色
            xAxis.setTickLabelPaint(new Color(102, 102, 102)); // 坐标轴标尺值颜色

            ValueAxis yAxis = xyplot.getRangeAxis();
            yAxis.setAxisLineStroke(new BasicStroke(1.5f));

            XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
            renderer.setSeriesOutlinePaint(0, Color.WHITE);
            renderer.setUseOutlinePaint(true);
            renderer.setSeriesShape(0, new Rectangle(15, 15)); // 设置形状及其大小（正方形）
            renderer.setSeriesShape(1, new Ellipse2D.Double(0, 0 , 15, 15)); // 圆形

            NumberAxis numberaxis = (NumberAxis) xyplot.getDomainAxis();
            numberaxis.setAutoRangeIncludesZero(true); // 设置轴的范围包括0
            numberaxis.setTickMarkInsideLength(2.0F);
            numberaxis.setTickMarkOutsideLength(0.0F);
            numberaxis.setAxisLineStroke(new BasicStroke(1.5f));
            numberaxis.setLabelFont(new Font("黑体",Font.BOLD,20));

            File file = new File(this.tempImageDir);
            if (!file.exists()) file.mkdir();
            String copImagePath = this.tempImageDir + File.separator + "cop.jpg";

            fos = new FileOutputStream(copImagePath);
            ChartUtilities.writeChartAsJPEG(fos, chart,  width, height);
            return true;
        } catch (IOException e) {
            e.printStackTrace();
            return false;
        } finally {
            try {
                if (fos!=null) fos.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    /**
     * 生成左右脚压力差值的平衡图
     * @param csvListLeft
     * @param csvListRight
     * @param width
     * @param height
     */
    private boolean generateBalance_other(List<String[]> csvListLeft, List<String[]> csvListRight, int width, int height) {
        FileOutputStream fos = null;
        try {
            DefaultCategoryDataset dataset = new DefaultCategoryDataset();

            List<String> leftX = new ArrayList<>();
            List<String> leftY = new ArrayList<>();
            List<String> rightX = new ArrayList<>();
            List<String> rightY = new ArrayList<>();

            double leftValue;
            double rightValue;

            if (csvListLeft.size() <= csvListRight.size()) {
                for (int i = 0; i < csvListLeft.size(); i++) {
                    leftValue = 0;
                    rightValue = 0;
                    for (int j = 0; j < 9; j++) {
                        leftValue += Double.parseDouble(csvListLeft.get(i)[j + 1]);
                        rightValue += Double.parseDouble(csvListRight.get(i)[j + 1]);
                    }
                    double v1 = leftValue / (leftValue + rightValue);
                    double v2 = rightValue / (leftValue + rightValue);
                    if (leftValue > rightValue) {
                        String p = String.valueOf((v2 - v1) * 100);
                        leftX.add(csvListLeft.get(i)[0]);
                        leftY.add(p);
                        dataset.addValue((v2 - v1) * 100, "左脚", getTwoDigits(csvListLeft.get(i)[0]));
                    } else {
                        String p = String.valueOf((v2 - v1) * 100);
                        rightX.add(csvListLeft.get(i)[0]);
                        rightY.add(p);
                        dataset.addValue((v2 - v1) * 100, "右脚", getTwoDigits(csvListLeft.get(i)[0]));
                    }
                }
            } else {
                for (int i = 0; i < csvListRight.size(); i++) {
                    leftValue = 0;
                    rightValue = 0;
                    for (int j = 0; j < 9; j++) {
                        leftValue += Double.parseDouble(csvListLeft.get(i)[j + 1]);
                        rightValue += Double.parseDouble(csvListRight.get(i)[j + 1]);
                    }
                    double v1 = leftValue / (leftValue + rightValue);
                    double v2 = rightValue / (leftValue + rightValue);
                    if (leftValue > rightValue) {
                        String p = String.valueOf((v2 - v1) * 100);
                        leftX.add(csvListRight.get(i)[0]);
                        leftY.add(p);
                        dataset.addValue((v2 - v1) * 100, "左脚", getTwoDigits(csvListRight.get(i)[0]));
                    } else {
                        String p = String.valueOf((v2 - v1) * 100);
                        rightX.add(csvListRight.get(i)[0]);
                        rightY.add(p);
                        dataset.addValue((v2 - v1) * 100, "右脚", getTwoDigits(csvListRight.get(i)[0]));
                    }
                }
            }

            // 左脚(x,y)坐标
            List<String> xListLeft = leftX;
            List<String> yListLeft = leftY;
            pictureData.put("balance_x_left", leftX);
            pictureData.put("balance_y_left", leftY);

            // 右脚(x,y)坐标
            List<String> xListRight = rightX;
            List<String> yListRight = rightY;
            pictureData.put("balance_x_right", rightX);
            pictureData.put("balance_y_right", rightY);

            JFreeChart chart = ChartFactory.createStackedAreaChart(null, "X(s)", "Y(%)", dataset, PlotOrientation.VERTICAL, true, true, false);

            chart.setBackgroundPaint(Color.white);
            LegendTitle legend = chart.getLegend(); // 图例
            legend.setItemFont(new Font("黑体", Font.BOLD, 30));

            CategoryPlot plot = chart.getCategoryPlot();
            plot.setBackgroundPaint(Color.WHITE); // 设置绘图区背景色
            plot.setRangeGridlinePaint(Color.GRAY); // 设置水平方向背景线颜色
            plot.setRangeGridlinesVisible(false);// 设置是否显示水平方向背景线,默认值为true
            plot.setDomainGridlinePaint(Color.GRAY); // 设置垂直方向背景线颜色
            plot.setDomainGridlinesVisible(false); // 设置是否显示垂直方向背景线,默认值为false

            CategoryAxis domainAxis = plot.getDomainAxis();
            domainAxis.setVisible(false);

            File file = new File(this.tempImageDir);
            if (!file.exists()) file.mkdir();
            String imagePath = this.tempImageDir + File.separator + "balance.jpg";

            fos = new FileOutputStream(imagePath);
            ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            return true;
        } catch (IOException e) {
            e.printStackTrace();
            return false;
        } finally {
            try {
                if (fos != null) fos.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }


    private boolean generateBalance(List<String[]> csvListLeft, List<String[]> csvListRight, int width, int height) {
        FileOutputStream fos = null;
        try {
            DefaultXYDataset xydataset = new DefaultXYDataset();

            Map<String, Map<Integer, List<String>>> map = new HashMap<>();

            Map<Integer, List<String>> xyMapLeft = new HashMap<>();
            Map<Integer, List<String>> xyMapRight = new HashMap<>();

            double leftValue;
            double rightValue;
            List<String> leftX = new ArrayList<>();
            List<String> leftY = new ArrayList<>();
            List<String> rightX = new ArrayList<>();
            List<String> rightY = new ArrayList<>();
            if(csvListLeft.size() <= csvListRight.size()) {
                for (int i=0; i<csvListLeft.size(); i++) {
                    leftValue = 0;
                    rightValue = 0;
                    for (int j=0; j<9; j++) {
                        leftValue += Double.parseDouble(csvListLeft.get(i)[j+1]);
                        rightValue += Double.parseDouble(csvListRight.get(i)[j+1]);
                    }
                    double v1 = leftValue / (leftValue + rightValue);
                    double v2 = rightValue / (leftValue + rightValue);
                    if(leftValue > rightValue) {
                        String p = String.valueOf((v2 - v1) * 100);
                        leftX.add(p);
                        leftY.add(csvListLeft.get(i)[0]);
                    } else {
                        String p = String.valueOf((v2 - v1) * 100);
                        rightX.add(p);
                        rightY.add(csvListLeft.get(i)[0]);
                    }
                }
            } else {
                for (int i=0; i<csvListRight.size(); i++) {
                    leftValue = 0;
                    rightValue = 0;
                    for (int j=0; j<9; j++) {
                        leftValue += Double.parseDouble(csvListLeft.get(i)[j+1]);
                        rightValue += Double.parseDouble(csvListRight.get(i)[j+1]);
                    }
                    double v1 = leftValue / (leftValue + rightValue);
                    double v2 = rightValue / (leftValue + rightValue);
                    if(leftValue > rightValue) {
                        String p = String.valueOf((v2 - v1) * 100);
                        leftX.add(p);
                        leftY.add(csvListRight.get(i)[0]);
                    } else {
                        String p = String.valueOf((v2 - v1) * 100);
                        rightX.add(p);
                        rightY.add(csvListRight.get(i)[0]);
                    }
                }
            }

            // 左脚(x,y)坐标
            List<String> xListLeft = leftX;
            List<String> yListLeft = leftY;
            pictureData.put("balance_x_left", leftX);
            pictureData.put("balance_y_left", leftY);

            // 右脚(x,y)坐标
            List<String> xListRight = rightX;
            List<String> yListRight = rightY;
            pictureData.put("balance_x_right", rightX);
            pictureData.put("balance_y_right", rightY);

            xyMapLeft.put(0, xListLeft);
            xyMapLeft.put(1, yListLeft);
            xyMapRight.put(0, xListRight);
            xyMapRight.put(1, yListRight);

            map.put("左脚", xyMapLeft);
            map.put("右脚", xyMapRight);

            //根据类别建立数据集
            for (Map.Entry<String,Map<Integer, List<String>>> entry : map.entrySet()) {
                Map<Integer, List<String>> entryValue = entry.getValue();
                int size = entryValue.get(0).size();
                //散点图要求数据集为二维数组
                double[][] datas = new double[2][size];
                for (int i = 0; i < size; i++) {
                    String xData = entryValue.get(0).get(i);
                    String yData = entryValue.get(1).get(i);
                    Double x = getTwoDigits(xData);
                    Double y = getTwoDigits(yData);
                    // 忽略坐标有null或者空字符串的情况
                    if(x==null || y==null) {
                        continue;
                    }
                    datas[0][i] = x;
                    datas[1][i] = y;
                }
                xydataset.addSeries(entry.getKey(), datas);
            }

            JFreeChart chart = ChartFactory.createScatterPlot(null, "X(s)", "Y(%)",
                    xydataset, PlotOrientation.VERTICAL, true, false, false);

            LegendTitle legend = chart.getLegend(); // 图例
            legend.setItemFont(new Font("黑体", Font.BOLD, 30));

            chart.setBackgroundPaint(Color.white);
            chart.setBorderPaint(Color.GREEN);
            chart.setBorderStroke(new BasicStroke(1.5f));

            XYPlot xyplot = (XYPlot) chart.getPlot();
            xyplot.setBackgroundPaint(new Color(255, 253, 246));
            xyplot.setOutlineStroke(new BasicStroke(1.5f)); // 边框粗细

            ValueAxis xAxis = xyplot.getDomainAxis();
            xAxis.setAxisLineStroke(new BasicStroke(1.5f)); // 坐标轴粗细
            xAxis.setAxisLinePaint(new Color(215, 215, 215)); // 坐标轴颜色
            xAxis.setLabelPaint(new Color(10, 10, 10)); // 坐标轴标题颜色
            xAxis.setTickLabelPaint(new Color(102, 102, 102)); // 坐标轴标尺值颜色
            xAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 22)); // 设置x轴的数值字体样式
            xAxis.setLabelFont(new Font("黑体", Font.BOLD, 30));

            ValueAxis yAxis = xyplot.getRangeAxis();
            yAxis.setAxisLineStroke(new BasicStroke(1.5f));
            yAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 22)); // 设置y轴的数值字体样式
            yAxis.setLabelFont(new Font("黑体", Font.BOLD, 30));

            XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
            renderer.setSeriesOutlinePaint(0, Color.WHITE);
            renderer.setUseOutlinePaint(true);
            renderer.setSeriesShape(0, new Rectangle(15, 15)); // 设置形状及其大小（正方形）
            renderer.setSeriesShape(1, new Ellipse2D.Double(0, 0 , 15, 15)); // 圆形

            NumberAxis numberAxis = (NumberAxis) xyplot.getDomainAxis();
            numberAxis.setAutoRangeIncludesZero(false);
            numberAxis.setTickMarkInsideLength(2.0F);
            numberAxis.setTickMarkOutsideLength(0.0F);
            numberAxis.setAxisLineStroke(new BasicStroke(1.5f));

            File file = new File(this.tempImageDir);
            if (!file.exists()) file.mkdir();
            String copImagePath = this.tempImageDir + File.separator + "balance.jpg";

            fos = new FileOutputStream(copImagePath);
            ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            return true;
        } catch (IOException e) {
            e.printStackTrace();
            return false;
        } finally {
            try {
                if (fos!=null) fos.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    /**
     * 生成前后足的偏移图   "foreHind.jpg"
     * @param csvListLeft
     * @param csvListRight
     * @param width
     * @param height
     */
    private boolean generateOffsetOne(List<String[]> csvListLeft, List<String[]> csvListRight, int width, int height) {
        FileOutputStream fos = null;
        try {
            DefaultXYDataset xydataset = new DefaultXYDataset();

            Map<String, Map<Integer, List<String>>> map = new HashMap<>();

            Map<Integer, List<String>> xyMapFore = new HashMap<>(); // 前足
            Map<Integer, List<String>> xyMapHind = new HashMap<>(); // 后足

            List<String> foreX = new ArrayList<>();
            List<String> foreY = new ArrayList<>();

            List<String> hindX = new ArrayList<>();
            List<String> hindY = new ArrayList<>();

            double foreValue;
            double hindValue;
            double v1;
            double v2;
            if(csvListLeft.size() <= csvListRight.size()) {
                for (int i=0; i<csvListLeft.size(); i++) {

                    foreValue = Double.parseDouble(csvListLeft.get(i)[1]) + Double.parseDouble(csvListLeft.get(i)[2]) + Double.parseDouble(csvListLeft.get(i)[8]) + Double.parseDouble(csvListLeft.get(i)[9]) +
                            Double.parseDouble(csvListRight.get(i)[1]) + Double.parseDouble(csvListRight.get(i)[2]) + Double.parseDouble(csvListRight.get(i)[8]) + Double.parseDouble(csvListRight.get(i)[9]);

                    hindValue = Double.parseDouble(csvListLeft.get(i)[4]) + Double.parseDouble(csvListLeft.get(i)[5]) + Double.parseDouble(csvListLeft.get(i)[6]) +
                            Double.parseDouble(csvListRight.get(i)[4]) + Double.parseDouble(csvListRight.get(i)[5]) + Double.parseDouble(csvListRight.get(i)[6]);

                    v1 = foreValue / (foreValue + hindValue);
                    v2 = hindValue / (foreValue + hindValue);

                    if(foreValue >= hindValue) {
                        String p = String.valueOf((v1 - v2) * 100);
                        foreX.add(csvListLeft.get(i)[0]);
                        foreY.add(p);
                    } else {
                        String p = String.valueOf((v1 - v2) * 100);
                        hindX.add(csvListLeft.get(i)[0]);
                        hindY.add(p);
                    }
                }
            } else {
                for (int i=0; i<csvListRight.size(); i++) {

                    foreValue = Double.parseDouble(csvListLeft.get(i)[1]) + Double.parseDouble(csvListLeft.get(i)[2]) + Double.parseDouble(csvListLeft.get(i)[8]) + Double.parseDouble(csvListLeft.get(i)[9]) +
                            Double.parseDouble(csvListRight.get(i)[1]) + Double.parseDouble(csvListRight.get(i)[2]) + Double.parseDouble(csvListRight.get(i)[8]) + Double.parseDouble(csvListRight.get(i)[9]);

                    hindValue = Double.parseDouble(csvListRight.get(i)[4]) + Double.parseDouble(csvListLeft.get(i)[5]) + Double.parseDouble(csvListLeft.get(i)[6]) +
                            Double.parseDouble(csvListRight.get(i)[4]) + Double.parseDouble(csvListRight.get(i)[5]) + Double.parseDouble(csvListRight.get(i)[6]);

                    v1 = foreValue / (foreValue + hindValue);
                    v2 = hindValue / (foreValue + hindValue);

                    if(foreValue >= hindValue) {
                        String p = String.valueOf((v1 - v2) * 100);
                        foreX.add(csvListRight.get(i)[0]);
                        foreY.add(p);
                    } else {
                        String p = String.valueOf((v1 - v2) * 100);
                        hindX.add(csvListRight.get(i)[0]);
                        hindY.add(p);
                    }
                }
            }

            // 前足(x,y)坐标
            List<String> xListFore = foreX;
            List<String> yListFore = foreY;
            pictureData.put("fore_x", xListFore);
            pictureData.put("fore_y", yListFore);

            // 后足(x,y)坐标
            List<String> xListHind = hindX;
            List<String> yListHind = hindY;
            pictureData.put("hind_x", hindX);
            pictureData.put("hind_y", hindY);

            xyMapFore.put(0, xListFore);
            xyMapFore.put(1, yListFore);
            xyMapHind.put(0, xListHind);
            xyMapHind.put(1, yListHind);

            map.put("前足", xyMapFore);
            map.put("后足", xyMapHind);

            //根据类别建立数据集
            for (Map.Entry<String,Map<Integer, List<String>>> entry : map.entrySet()) {
                Map<Integer, List<String>> entryValue = entry.getValue();
                int size = entryValue.get(0).size();
                //散点图要求数据集为二维数组
                double[][] datas = new double[2][size];
                for (int i = 0; i < size; i++) {
                    String xData = entryValue.get(0).get(i);
                    String yData = entryValue.get(1).get(i);
                    Double x = getTwoDigits(xData);
                    Double y = getTwoDigits(yData);
                    // 忽略坐标有null或者空字符串的情况
                    if(x==null || y==null) continue;
                    datas[0][i] = x;
                    datas[1][i] = y;
                }
                xydataset.addSeries(entry.getKey(), datas);
            }

            JFreeChart chart = ChartFactory.createScatterPlot(null, "X(s)", "Y(%)", xydataset, PlotOrientation.VERTICAL, true, false, false);

            chart.setBackgroundPaint(Color.white);
            chart.setBorderPaint(Color.GREEN);
            chart.setBorderStroke(new BasicStroke(1.5f));

            LegendTitle legend = chart.getLegend(); // 图例
            legend.setItemFont(new Font("黑体", Font.BOLD, 30));

            XYPlot xyplot = (XYPlot) chart.getPlot();
            xyplot.setBackgroundPaint(new Color(255, 253, 246));
            xyplot.setOutlineStroke(new BasicStroke(1.5f)); // 边框粗细

            ValueAxis xAxis = xyplot.getDomainAxis();
            xAxis.setAxisLineStroke(new BasicStroke(1.5f)); // 坐标轴粗细
            xAxis.setAxisLinePaint(new Color(215, 215, 215)); // 坐标轴颜色
            xAxis.setLabelPaint(new Color(10, 10, 10)); // 坐标轴标题颜色
            xAxis.setTickLabelPaint(new Color(102, 102, 102)); // 坐标轴标尺值颜色
            xAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 22)); // 设置x轴的数值字体样式
            xAxis.setLabelFont(new Font("黑体", Font.BOLD, 30));

            ValueAxis yAxis = xyplot.getRangeAxis();
            yAxis.setAxisLineStroke(new BasicStroke(1.5f));
            yAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 22)); // 设置y轴的数值字体样式
            yAxis.setLabelFont(new Font("黑体", Font.BOLD, 30));

            XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
            renderer.setSeriesOutlinePaint(0, Color.WHITE);
            renderer.setUseOutlinePaint(true);
            renderer.setSeriesShape(0, new Rectangle(15, 15)); // 设置形状及其大小（正方形）
            renderer.setSeriesShape(1, new Ellipse2D.Double(0, 0 , 15, 15)); // 圆形

            NumberAxis numberAxis = (NumberAxis) xyplot.getDomainAxis();
            numberAxis.setAutoRangeIncludesZero(false);
            numberAxis.setTickMarkInsideLength(2.0F);
            numberAxis.setTickMarkOutsideLength(0.0F);
            numberAxis.setAxisLineStroke(new BasicStroke(1.5f));

            File file = new File(this.tempImageDir);
            if (!file.exists()) file.mkdir();
            String imagePath = this.tempImageDir + File.separator + "foreHind.jpg";

            fos = new FileOutputStream(imagePath);
            ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            return true;
        } catch (IOException e) {
            e.printStackTrace();
            return false;
        } finally {
            try {
                if (fos!=null) fos.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    /**
     * 生成前后足的偏移图-面积图
     *
     * @param csvListLeft
     * @param csvListRight
     * @param width
     * @param height
     */
    private boolean generateOffsetOne_other(List<String[]> csvListLeft, List<String[]> csvListRight, int width, int height) {
        FileOutputStream fos = null;
        try {
            DefaultCategoryDataset dataset = new DefaultCategoryDataset();

            List<String> foreX = new ArrayList<>();
            List<String> foreY = new ArrayList<>();

            List<String> hindX = new ArrayList<>();
            List<String> hindY = new ArrayList<>();

            double foreValue;
            double hindValue;
            double v1;
            double v2;
            if (csvListLeft.size() <= csvListRight.size()) {
                for (int i = 0; i < csvListLeft.size(); i++) {

                    foreValue = Double.parseDouble(csvListLeft.get(i)[1]) + Double.parseDouble(csvListLeft.get(i)[2]) + Double.parseDouble(csvListLeft.get(i)[8]) + Double.parseDouble(csvListLeft.get(i)[9]) +
                            Double.parseDouble(csvListRight.get(i)[1]) + Double.parseDouble(csvListRight.get(i)[2]) + Double.parseDouble(csvListRight.get(i)[8]) + Double.parseDouble(csvListRight.get(i)[9]);

                    hindValue = Double.parseDouble(csvListLeft.get(i)[4]) + Double.parseDouble(csvListLeft.get(i)[5]) + Double.parseDouble(csvListLeft.get(i)[6]) +
                            Double.parseDouble(csvListRight.get(i)[4]) + Double.parseDouble(csvListRight.get(i)[5]) + Double.parseDouble(csvListRight.get(i)[6]);

                    v1 = foreValue / (foreValue + hindValue);
                    v2 = hindValue / (foreValue + hindValue);

                    if (foreValue >= hindValue) {
                        String p = String.valueOf((v1 - v2) * 100);
                        foreX.add(csvListLeft.get(i)[0]);
                        foreY.add(p);
                        dataset.addValue((v1 - v2) * 100, "前足", getTwoDigits(csvListLeft.get(i)[0]));
                    } else {
                        String p = String.valueOf((v2 - v1) * 100);
                        hindX.add(csvListLeft.get(i)[0]);
                        hindY.add(p);
                        dataset.addValue((v2 - v1) * 100, "后足", getTwoDigits(csvListLeft.get(i)[0]));
                    }
                }
            } else {
                for (int i = 0; i < csvListRight.size(); i++) {

                    foreValue = Double.parseDouble(csvListLeft.get(i)[1]) + Double.parseDouble(csvListLeft.get(i)[2]) + Double.parseDouble(csvListLeft.get(i)[8]) + Double.parseDouble(csvListLeft.get(i)[9]) +
                            Double.parseDouble(csvListRight.get(i)[1]) + Double.parseDouble(csvListRight.get(i)[2]) + Double.parseDouble(csvListRight.get(i)[8]) + Double.parseDouble(csvListRight.get(i)[9]);

                    hindValue = Double.parseDouble(csvListRight.get(i)[4]) + Double.parseDouble(csvListLeft.get(i)[5]) + Double.parseDouble(csvListLeft.get(i)[6]) +
                            Double.parseDouble(csvListRight.get(i)[4]) + Double.parseDouble(csvListRight.get(i)[5]) + Double.parseDouble(csvListRight.get(i)[6]);

                    v1 = foreValue / (foreValue + hindValue);
                    v2 = hindValue / (foreValue + hindValue);

                    if (foreValue >= hindValue) {
                        String p = String.valueOf((v1 - v2) * 100);
                        foreX.add(csvListRight.get(i)[0]);
                        foreY.add(p);
                        dataset.addValue((v1 - v2) * 100, "前足", getTwoDigits(csvListRight.get(i)[0]));
                    } else {
                        String q = String.valueOf((v2 - v1) * 100);
                        hindX.add(csvListRight.get(i)[0]);
                        hindY.add(q);
                        dataset.addValue((v2 - v1) * 100, "后足", getTwoDigits(csvListRight.get(i)[0]));
                    }
                }
            }

            // 前足(x,y)坐标
            List<String> xListFore = foreX;
            List<String> yListFore = foreY;
            pictureData.put("fore_x", xListFore);
            pictureData.put("fore_y", yListFore);

            // 后足(x,y)坐标
            List<String> xListHind = hindX;
            List<String> yListHind = hindY;
            pictureData.put("hind_x", xListHind);
            pictureData.put("hind_y", yListHind);


            JFreeChart chart = ChartFactory.createStackedAreaChart(null, "X(s)", "Y(%)", dataset, PlotOrientation.VERTICAL, true, true, false);

            chart.setBackgroundPaint(Color.white);
            LegendTitle legend = chart.getLegend(); // 图例
            legend.setItemFont(new Font("黑体", Font.BOLD, 30));

            CategoryPlot plot = chart.getCategoryPlot();
            plot.setBackgroundPaint(Color.WHITE); // 设置绘图区背景色
            plot.setRangeGridlinePaint(Color.GRAY); // 设置水平方向背景线颜色
            plot.setRangeGridlinesVisible(false);// 设置是否显示水平方向背景线,默认值为true
            plot.setDomainGridlinePaint(Color.GRAY); // 设置垂直方向背景线颜色
            plot.setDomainGridlinesVisible(false); // 设置是否显示垂直方向背景线,默认值为false

            CategoryAxis domainAxis = plot.getDomainAxis();
            domainAxis.setVisible(false);

            File file = new File(this.tempImageDir);
            if (!file.exists()) file.mkdir();
            String imagePath = this.tempImageDir + File.separator + "foreHind.jpg";

            fos = new FileOutputStream(imagePath);
            ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            return true;
        } catch (IOException e) {
            e.printStackTrace();
            return false;
        } finally {
            try {
                if (fos != null) fos.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    /**
     * 生成内外侧的偏移图-面积图  "inout.jpg"
     *
     * @param csvListLeft
     * @param csvListRight
     * @param width
     * @param height
     */
    private boolean generateOffsetTwo(List<String[]> csvListLeft, List<String[]> csvListRight, int width, int height) {
        FileOutputStream fos = null;
        try {
            DefaultCategoryDataset dataset = new DefaultCategoryDataset();

            List<String> insideX = new ArrayList<>();
            List<String> insideY = new ArrayList<>();

            List<String> outsideX = new ArrayList<>();
            List<String> outsideY = new ArrayList<>();

            double insideValue;
            double outsideValue;
            double v1;
            double v2;
            if (csvListLeft.size() <= csvListRight.size()) {
                for (int i = 0; i < csvListLeft.size(); i++) {

                    insideValue = Double.parseDouble(csvListLeft.get(i)[1]) + Double.parseDouble(csvListLeft.get(i)[2]) + Double.parseDouble(csvListLeft.get(i)[3]) + Double.parseDouble(csvListLeft.get(i)[4]) +
                            Double.parseDouble(csvListRight.get(i)[1]) + Double.parseDouble(csvListRight.get(i)[2]) + Double.parseDouble(csvListRight.get(i)[3]) + Double.parseDouble(csvListRight.get(i)[4]);

                    outsideValue = Double.parseDouble(csvListLeft.get(i)[6]) + Double.parseDouble(csvListLeft.get(i)[7]) + Double.parseDouble(csvListLeft.get(i)[8]) +
                            Double.parseDouble(csvListRight.get(i)[6]) + Double.parseDouble(csvListRight.get(i)[7]) + Double.parseDouble(csvListRight.get(i)[8]);

                    v1 = insideValue / (insideValue + outsideValue);
                    v2 = outsideValue / (insideValue + outsideValue);

                    if (insideValue >= outsideValue) {
                        String p = String.valueOf((v1 - v2) * 100);
                        insideX.add(csvListLeft.get(i)[0]);
                        insideY.add(p);
                        dataset.addValue((v1 - v2) * 100, "内足", getTwoDigits(csvListLeft.get(i)[0]));
                    } else {
                        String p = String.valueOf((v2 - v1) * 100);
                        outsideX.add(csvListLeft.get(i)[0]);
                        outsideY.add(p);
                        dataset.addValue((v2 - v1) * 100, "外足", getTwoDigits(csvListLeft.get(i)[0]));
                    }
                }
            } else {
                for (int i = 0; i < csvListRight.size(); i++) {

                    insideValue = Double.parseDouble(csvListLeft.get(i)[1]) + Double.parseDouble(csvListLeft.get(i)[2]) + Double.parseDouble(csvListLeft.get(i)[3]) + Double.parseDouble(csvListLeft.get(i)[4]) +
                            Double.parseDouble(csvListRight.get(i)[1]) + Double.parseDouble(csvListRight.get(i)[2]) + Double.parseDouble(csvListRight.get(i)[3]) + Double.parseDouble(csvListRight.get(i)[4]);

                    outsideValue = Double.parseDouble(csvListLeft.get(i)[6]) + Double.parseDouble(csvListLeft.get(i)[7]) + Double.parseDouble(csvListLeft.get(i)[8]) +
                            Double.parseDouble(csvListRight.get(i)[6]) + Double.parseDouble(csvListRight.get(i)[7]) + Double.parseDouble(csvListRight.get(i)[8]);

                    v1 = insideValue / (insideValue + outsideValue);
                    v2 = outsideValue / (insideValue + outsideValue);

                    if (insideValue >= outsideValue) {
                        String p = String.valueOf((v1 - v2) * 100);
                        insideX.add(csvListRight.get(i)[0]);
                        insideY.add(p);
                        dataset.addValue((v1 - v2) * 100, "内足", getTwoDigits(csvListRight.get(i)[0]));
                    } else {
                        String q = String.valueOf((v2 - v1) * 100);
                        outsideX.add(csvListRight.get(i)[0]);
                        outsideY.add(q);
                        dataset.addValue((v2 - v1) * 100, "外足", getTwoDigits(csvListRight.get(i)[0]));
                    }
                }
            }

            // 内侧(x,y)坐标
            List<String> xListInside = insideX;
            List<String> yListInside = insideY;
            pictureData.put("inside_x", xListInside);
            pictureData.put("inside_y", yListInside);

            // 外侧(x,y)坐标
            List<String> xListOutside = outsideX;
            List<String> yListOutside = outsideY;
            pictureData.put("outside_x", xListOutside);
            pictureData.put("outside_y", yListOutside);


            JFreeChart chart = ChartFactory.createStackedAreaChart(null, "X(s)", "Y(%)", dataset, PlotOrientation.VERTICAL, true, true, false);

            chart.setBackgroundPaint(Color.white);
            LegendTitle legend = chart.getLegend(); // 图例
            legend.setItemFont(new Font("黑体", Font.BOLD, 30));

            CategoryPlot plot = chart.getCategoryPlot();
            plot.setBackgroundPaint(Color.WHITE); // 设置绘图区背景色
            plot.setRangeGridlinePaint(Color.GRAY); // 设置水平方向背景线颜色
            plot.setRangeGridlinesVisible(false);// 设置是否显示水平方向背景线,默认值为true
            plot.setDomainGridlinePaint(Color.GRAY); // 设置垂直方向背景线颜色
            plot.setDomainGridlinesVisible(false); // 设置是否显示垂直方向背景线,默认值为false

            CategoryAxis domainAxis = plot.getDomainAxis();
            domainAxis.setVisible(false);

            File file = new File(this.tempImageDir);
            if (!file.exists()) file.mkdir();
            String imagePath = this.tempImageDir + File.separator + "inout.jpg";

            fos = new FileOutputStream(imagePath);
            ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            return true;
        } catch(
                IOException e)

        {
            e.printStackTrace();
            return false;
        } finally

        {
            try {
                if (fos != null) fos.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }


    /**
     * 生成平均百分比图   "average-percentage.jpg"
     * @param featureData
     * @param width
     * @param height
     * @return
     */
    private boolean generateAveragePercentage(FeatureData featureData, int width, int height) {
        FileOutputStream fos = null;
        try {
            double leftPressureValue = 0;
            double rightPressureValue = 0;

            // 左脚
            List<String> leftPressureList = new ArrayList<>();
            leftPressureList.add(featureData.getPressureMeanLeft1());
            leftPressureList.add(featureData.getPressureMeanLeft2());
            leftPressureList.add(featureData.getPressureMeanLeft3());
            leftPressureList.add(featureData.getPressureMeanLeft4());
            leftPressureList.add(featureData.getPressureMeanLeft5());
            leftPressureList.add(featureData.getPressureMeanLeft6());
            leftPressureList.add(featureData.getPressureMeanLeft7());
            leftPressureList.add(featureData.getPressureMeanLeft8());
            leftPressureList.add(featureData.getPressureMeanLeft9());

            // 右脚
            List<String> rightPressureList = new ArrayList<>();
            rightPressureList.add(featureData.getPressureMeanRigh1());
            rightPressureList.add(featureData.getPressureMeanRight2());
            rightPressureList.add(featureData.getPressureMeanRight3());
            rightPressureList.add(featureData.getPressureMeanRight4());
            rightPressureList.add(featureData.getPressureMeanRight5());
            rightPressureList.add(featureData.getPressureMeanRight6());
            rightPressureList.add(featureData.getPressureMeanRight7());
            rightPressureList.add(featureData.getPressureMeanRight8());
            rightPressureList.add(featureData.getPressureMeanRight9());

            for (int i=0; i<leftPressureList.size(); i++) {
                leftPressureValue += Double.parseDouble(leftPressureList.get(i));
                rightPressureValue += Double.parseDouble(rightPressureList.get(i));
            }

            double leftPercentage = NumberUtil.div(leftPressureValue, leftPressureValue + rightPressureValue, 2);
            double rightPercentage = NumberUtil.div(rightPressureValue, leftPressureValue + rightPressureValue, 2);
            double real_leftPercentage = NumberUtil.mul(leftPercentage, 100);
            double real_rightPercentage = NumberUtil.mul(rightPercentage, 100);

            pictureData.put("balance_percentage_left", leftPercentage);
            pictureData.put("balance_percentage_right", rightPercentage);

            DefaultPieDataset dataSet = new DefaultPieDataset();
            dataSet.setValue("左脚", real_leftPercentage);
            dataSet.setValue("右脚", real_rightPercentage);

            JFreeChart chart = ChartFactory.createPieChart3D(null, //标题
                            dataSet, //数据
                    false,  //是否显示图例
                    false, //是否生成工具
                    false); //是否生成URL链接

            chart.setBackgroundPaint(new GradientPaint(0, 0, new Color(255, 255, 255),
                              428,428,new Color(255, 255, 255)));
            chart.setBackgroundImageAlpha(0.8f);
            chart.setTextAntiAlias(false);

            PiePlot3D pie3d = (PiePlot3D)chart.getPlot();

            pie3d.setLabelFont(new Font("微软雅黑", Font.PLAIN, 20));
            pie3d.setLabelGap(0.02D);
            pie3d.setLabelBackgroundPaint(Color.white);
            pie3d.setLabelOutlinePaint(Color.white);
            pie3d.setLabelLinksVisible(false);
            //下面设置的是:饼图里面的百分比去除标签边框,只显示百分比的数据 (4个都要设置,缺一不可)
            pie3d.setLabelOutlinePaint(null);// (1)自定义标签产生器,设置绘图面板外边的填充颜色
            pie3d.setLabelShadowPaint(null);//自定义标签产生器, 设置绘图面板阴影的填充颜色
            pie3d.setLabelOutlineStroke(null);//(2) 自定义标签产生器,设置绘图面板外边的填充颜色

            pie3d.setCircular(false);
            pie3d.setOutlinePaint(Color.white);
            pie3d.setOutlineStroke(new BasicStroke(10));
            pie3d.setSectionOutlinesVisible(false);
            pie3d.setBackgroundPaint(Color.white);
            // 设置绘图面板阴影的填充颜色
            pie3d.setShadowPaint(Color.BLACK);
            //设置开始角度
            pie3d.setStartAngle(90D);
            //设置为顺时针方向
            pie3d.setDirection(Rotation.CLOCKWISE);
            //设置透明度， 0.5F为半透明，1为不透明，0为全透明
            pie3d.setForegroundAlpha(0.9f);
//            pie3d.setDepthFactor(10); //饼图的Z轴高度

            //设置每部分颜色
            pie3d.setSectionOutlinePaint("左脚", Color.white);
            pie3d.setSectionOutlinePaint("右脚", Color.white);
            pie3d.setSectionPaint("左脚", Color.decode("#EC5F74"));
            pie3d.setSectionPaint("右脚", Color.decode("#56CA95"));

            DecimalFormat df = new DecimalFormat("0%");
            NumberFormat nf = NumberFormat.getNumberInstance();
            StandardPieSectionLabelGenerator sp = new StandardPieSectionLabelGenerator("{2}", nf, df);
            pie3d.setLabelGenerator(sp);

            File file = new File(this.tempImageDir);
            if (!file.exists()) file.mkdir();
            String averagePercentagePath = this.tempImageDir + File.separator + "average-percentage.jpg";
            fos = new FileOutputStream(averagePercentagePath);
            ChartUtilities.writeChartAsJPEG(fos, chart, 500, 220);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        } finally {
            try {
                if (fos!=null) fos.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    /**
     * 生成平均压力值图   "average-pressure.jpg"
     * @param featureData
     * @param width
     * @param height
     * @return
     */
    private boolean generateAveragePressure(FeatureData featureData, int width, int height) {
        FileOutputStream fos = null;
        try {
            double leftPressureValue = 0;
            double rightPressureValue = 0;

            // 左脚
            List<String> leftPressureList = new ArrayList<>();
            leftPressureList.add(featureData.getPressureMeanLeft1());
            leftPressureList.add(featureData.getPressureMeanLeft2());
            leftPressureList.add(featureData.getPressureMeanLeft3());
            leftPressureList.add(featureData.getPressureMeanLeft4());
            leftPressureList.add(featureData.getPressureMeanLeft5());
            leftPressureList.add(featureData.getPressureMeanLeft6());
            leftPressureList.add(featureData.getPressureMeanLeft7());
            leftPressureList.add(featureData.getPressureMeanLeft8());
            leftPressureList.add(featureData.getPressureMeanLeft9());

            // 右脚
            List<String> rightPressureList = new ArrayList<>();
            rightPressureList.add(featureData.getPressureMeanRigh1());
            rightPressureList.add(featureData.getPressureMeanRight2());
            rightPressureList.add(featureData.getPressureMeanRight3());
            rightPressureList.add(featureData.getPressureMeanRight4());
            rightPressureList.add(featureData.getPressureMeanRight5());
            rightPressureList.add(featureData.getPressureMeanRight6());
            rightPressureList.add(featureData.getPressureMeanRight7());
            rightPressureList.add(featureData.getPressureMeanRight8());
            rightPressureList.add(featureData.getPressureMeanRight9());

            for (int i=0; i<leftPressureList.size(); i++) {
                leftPressureValue += Double.parseDouble(leftPressureList.get(i));
                rightPressureValue += Double.parseDouble(rightPressureList.get(i));
            }

            pictureData.put("balance_pressure_left", leftPressureValue);
            pictureData.put("balance_pressure_right", rightPressureValue);

            DefaultCategoryDataset dateSet = new DefaultCategoryDataset();
            dateSet.setValue(leftPressureValue, "左脚", "");
            dateSet.setValue(rightPressureValue, "右脚", "");

            JFreeChart chart = ChartFactory.createBarChart(null, //标题
                    null, //目录轴的显示标签
                    null, //数值的显示标签
                    dateSet, //数据
                    PlotOrientation.VERTICAL, //图标方向:水平/垂直
                    false,  //是否显示图例
                    false, //是否生成工具
                    false); //是否生成URL链接

//            LegendTitle legend = chart.getLegend(); // 图例
//            legend.setItemFont(new Font("黑体", Font.BOLD, 20));

            CategoryPlot categoryPlot = chart.getCategoryPlot();//图部分
            categoryPlot.setBackgroundPaint(ChartColor.WHITE); // 设置图的背景颜色
//            chart.getLegend().setItemFont( new Font("黑体",Font.BOLD,20));//图标字体

            CategoryAxis domainAxis = categoryPlot.getDomainAxis();//X轴
            domainAxis.setCategoryLabelPositions(CategoryLabelPositions.STANDARD);//X轴下标  90°显示
            domainAxis.setMaximumCategoryLabelLines(10);//自动换行    最多显示多少行
            domainAxis.setLabelFont(new Font("黑体",Font.BOLD,20));//下标
            domainAxis.setTickLabelFont(new Font("宋体",Font.BOLD,20));//X轴标题
            domainAxis.setAxisLineVisible(false);

            ValueAxis rangeAxis = categoryPlot.getRangeAxis();//Y轴
            rangeAxis.setLabelFont(new Font("黑体",Font.BOLD,20));//下标
            rangeAxis.setTickLabelFont(new Font("宋体",Font.BOLD,20));//Y轴标题
            rangeAxis.setLowerMargin(0); // 纵轴与底部的距离
            rangeAxis.setAxisLineVisible(false);

            NumberAxis numberAxis = (NumberAxis) categoryPlot.getRangeAxis();
            numberAxis.setAutoTickUnitSelection(true); // 是否自动设置Y轴刻度
            numberAxis.setAutoRangeStickyZero(true);//和下面一行搭配使用
            numberAxis.setRangeType(RangeType.POSITIVE); // 设置Y轴都是正数
            numberAxis.setNumberFormatOverride(new DecimalFormat("#"));//设置Y轴上的数值精度

            BarRenderer renderer = (BarRenderer) categoryPlot.getRenderer();//图形修改
            renderer.setItemMargin(0);//设置柱子之间的距离
            renderer.setPositiveItemLabelPositionFallback(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER));
            renderer.setDrawBarOutline(false);
            renderer.setMaximumBarWidth(0.2D); //设置柱子宽度
            renderer.setMinimumBarLength(0); //设置柱子高度
            renderer.setSeriesPaint(0, Color.decode("#EC5F74")); // 设置柱子的颜色
            renderer.setSeriesPaint(1, Color.decode("#56CA95"));  // 设置柱子的颜色

            renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); // 设置数值显示
            renderer.setBaseItemLabelsVisible(true);
            renderer.setBaseItemLabelFont(new Font("黑体",Font.BOLD,20));
            renderer.setBaseItemLabelPaint(ChartColor.BLACK);

            File file = new File(this.tempImageDir);
            if (!file.exists()) file.mkdir();
            String averagePressurePath = this.tempImageDir + File.separator + "average-pressure.jpg";
            fos = new FileOutputStream(averagePressurePath);
            ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        } finally {
            try {
                if (fos!=null) fos.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    /**生成fft图
     * @param csvListLeft
     * @param csvListRight

     * */
    private boolean generateFFT(List<String[]> csvListLeft, List<String[]> csvListRight,int width,int height) {
        //左脚九个压力点
        FileOutputStream fos = null;
        try {
            String[] leftTime1 = new String[csvListLeft.size()];
            String[] leftPressureOnedata1 = new String[csvListLeft.size()];
            String[] leftPressureTwodata1 = new String[csvListLeft.size()];
            String[] leftPressureThreedata1 = new String[csvListLeft.size()];
            String[] leftPressureFourdata1 = new String[csvListLeft.size()];
            String[] leftPressureFivedata1 = new String[csvListLeft.size()];
            String[] leftPressureSixdata1 = new String[csvListLeft.size()];
            String[] leftPressureSevendata1 = new String[csvListLeft.size()];
            String[] leftPressureEightdata1 = new String[csvListLeft.size()];
            String[] leftPressureNinedata1 = new String[csvListLeft.size()];
            for (int i = 0; i < csvListLeft.size(); i++) {
                String[] item1 = csvListLeft.get(i);
                leftTime1[i] = item1[0];                   //leftTime
                leftPressureOnedata1[i] = item1[1];
                leftPressureTwodata1[i] = item1[2];
                leftPressureThreedata1[i] = item1[3];
                leftPressureFourdata1[i] = item1[4];
                leftPressureFivedata1[i] = item1[5];
                leftPressureSixdata1[i] = item1[6];
                leftPressureSevendata1[i] = item1[7];
                leftPressureEightdata1[i] = item1[8];
                leftPressureNinedata1[i] = item1[9];
            }

            //将string转化为double
            double[] leftTime = Arrays.asList(leftTime1).stream().mapToDouble(Double::parseDouble).toArray();//leftPressureOnedata
            double[] leftPressureOnedata = Arrays.asList(leftPressureOnedata1).stream().mapToDouble(Double::parseDouble).toArray();//leftPressureOnedata
            double[] leftPressureTwodata = Arrays.asList(leftPressureTwodata1).stream().mapToDouble(Double::parseDouble).toArray();//leftPressureTwodata
            double[] leftPressureThreedata = Arrays.asList(leftPressureThreedata1).stream().mapToDouble(Double::parseDouble).toArray();//leftPressureThreedata
            double[] leftPressureFourdata = Arrays.asList(leftPressureFourdata1).stream().mapToDouble(Double::parseDouble).toArray();//leftPressureFourdata
            double[] leftPressureFivedata = Arrays.asList(leftPressureFivedata1).stream().mapToDouble(Double::parseDouble).toArray();//leftPressureFivedata
            double[] leftPressureSixdata = Arrays.asList(leftPressureSixdata1).stream().mapToDouble(Double::parseDouble).toArray();//leftPressureSixdata
            double[] leftPressureSevendata = Arrays.asList(leftPressureSevendata1).stream().mapToDouble(Double::parseDouble).toArray();//leftPressureSevendata
            double[] leftPressureEightdata = Arrays.asList(leftPressureEightdata1).stream().mapToDouble(Double::parseDouble).toArray();//leftPressureEightdata
            double[] leftPressureNinedata = Arrays.asList(leftPressureNinedata1).stream().mapToDouble(Double::parseDouble).toArray();//leftPressureNinedata

            //定义左脚各压力点的复数
            Complex[] leftPressureOnedataComplex = new Complex[leftTime.length];
            Complex[] leftPressureTwodataComplex = new Complex[leftTime.length];
            Complex[] leftPressureThreedataComplex = new Complex[leftTime.length];
            Complex[] leftPressureFourdataComplex = new Complex[leftTime.length];
            Complex[] leftPressureFivedataComplex = new Complex[leftTime.length];
            Complex[] leftPressureSixdataComplex = new Complex[leftTime.length];
            Complex[] leftPressureSevendataComplex = new Complex[leftTime.length];
            Complex[] leftPressureEightdataComplex = new Complex[leftTime.length];
            Complex[] leftPressureNinedataComplex = new Complex[leftTime.length];


            double samplingFrequency = 100;   //压力点抽样频率
            double len = leftTime.length;     //抽样点数
            double dFrequency = samplingFrequency / len;    //单位抽样频率
            double[] Frequency = new double[leftTime.length]; //定义频率数组
            //将double转化为comlex
            for (int i = 0; i < leftTime.length; i++) {
                leftPressureOnedataComplex[i] = new Complex(leftPressureOnedata[i], 0);
                leftPressureTwodataComplex[i] = new Complex(leftPressureTwodata[i], 0);
                leftPressureThreedataComplex[i] = new Complex(leftPressureThreedata[i], 0);
                leftPressureFourdataComplex[i] = new Complex(leftPressureFourdata[i], 0);
                leftPressureFivedataComplex[i] = new Complex(leftPressureFivedata[i], 0);
                leftPressureSixdataComplex[i] = new Complex(leftPressureSixdata[i], 0);
                leftPressureSevendataComplex[i] = new Complex(leftPressureSevendata[i], 0);
                leftPressureEightdataComplex[i] = new Complex(leftPressureEightdata[i], 0);
                leftPressureNinedataComplex[i] = new Complex(leftPressureNinedata[i], 0);

            }
            //左脚各压力点的fft
            Complex[] leftPressureOnedataFFT = fft(leftPressureOnedataComplex);
            Complex[] leftPressureTwodataFFT = fft(leftPressureTwodataComplex);
            Complex[] leftPressureThreedataFFT = fft(leftPressureThreedataComplex);
            Complex[] leftPressureFourdataFFT = fft(leftPressureFourdataComplex);
            Complex[] leftPressureFivedataFFT = fft(leftPressureFivedataComplex);
            Complex[] leftPressureSixdataFFT = fft(leftPressureSixdataComplex);
            Complex[] leftPressureSevendataFFT = fft(leftPressureSevendataComplex);
            Complex[] leftPressureEightdataFFT = fft(leftPressureEightdataComplex);
            Complex[] leftPressureNinedataFFT = fft(leftPressureNinedataComplex);

            //定义FFT的abs
            double[] leftPressureOnedataFFTAbs = new double[leftPressureOnedataFFT.length];
            double[] leftPressureTwodataFFTAbs = new double[leftPressureTwodataFFT.length];
            double[] leftPressureThreedataFFTAbs = new double[leftPressureThreedataFFT.length];
            double[] leftPressureFourdataFFTAbs = new double[leftPressureFourdataFFT.length];
            double[] leftPressureFivedataFFTAbs = new double[leftPressureFivedataFFT.length];
            double[] leftPressureSixdataFFTAbs = new double[leftPressureSixdataFFT.length];
            double[] leftPressureSevendataFFTAbs = new double[leftPressureSevendataFFT.length];
            double[] leftPressureEightdataFFTAbs = new double[leftPressureEightdataFFT.length];
            double[] leftPressureNinedataFFTAbs = new double[leftPressureNinedataFFT.length];
            List<String> FrequencyX = new ArrayList<>();
            List<String> leftPressureFFTY1 = new ArrayList<>();
            List<String> leftPressureFFTY2 = new ArrayList<>();
            List<String> leftPressureFFTY3 = new ArrayList<>();
            List<String> leftPressureFFTY4 = new ArrayList<>();
            List<String> leftPressureFFTY5 = new ArrayList<>();
            List<String> leftPressureFFTY6 = new ArrayList<>();
            List<String> leftPressureFFTY7 = new ArrayList<>();
            List<String> leftPressureFFTY8 = new ArrayList<>();
            List<String> leftPressureFFTY9 = new ArrayList<>();

            //取左脚各个压力fft的abs
            for (int i = 0; i < leftTime.length; i++) {
                Frequency[i] = i * dFrequency;
                double imag1 = leftPressureOnedataFFT[i].im();
                double real1 = leftPressureOnedataFFT[i].re();
                leftPressureOnedataFFTAbs[i] = Math.hypot(real1, imag1) / leftTime.length;
                String y1 = String.valueOf(leftPressureOnedataFFTAbs[i]);
                String x = String.valueOf(Frequency[i]);
                leftPressureFFTY1.add(y1);
                FrequencyX.add(x);

                double imag2 = leftPressureTwodataFFT[i].im();
                double real2 = leftPressureTwodataFFT[i].re();
                leftPressureTwodataFFTAbs[i] = Math.hypot(real2, imag2) / leftTime.length;
                String y2 = String.valueOf(leftPressureTwodataFFTAbs[i]);
                leftPressureFFTY2.add(y2);

                double imag3 = leftPressureThreedataFFT[i].im();
                double real3 = leftPressureThreedataFFT[i].re();
                leftPressureThreedataFFTAbs[i] = Math.hypot(real3, imag3) / leftTime.length;
                String y3 = String.valueOf(leftPressureThreedataFFTAbs[i]);
                leftPressureFFTY3.add(y3);

                double imag4 = leftPressureFourdataFFT[i].im();
                double real4 = leftPressureFourdataFFT[i].re();
                leftPressureFourdataFFTAbs[i] = Math.hypot(real4, imag4) / leftTime.length;
                String y4 = String.valueOf(leftPressureFourdataFFTAbs[i]);
                leftPressureFFTY4.add(y4);

                double imag5 = leftPressureFivedataFFT[i].im();
                double real5 = leftPressureFivedataFFT[i].re();
                leftPressureFivedataFFTAbs[i] = Math.hypot(real5, imag5) / leftTime.length;
                String y5 = String.valueOf(leftPressureFivedataFFTAbs[i]);
                leftPressureFFTY5.add(y5);

                double imag6 = leftPressureSixdataFFT[i].im();
                double real6 = leftPressureSixdataFFT[i].re();
                leftPressureSixdataFFTAbs[i] = Math.hypot(real6, imag6) / leftTime.length;
                String y6 = String.valueOf(leftPressureSixdataFFTAbs[i]);
                leftPressureFFTY6.add(y6);

                double imag7 = leftPressureSevendataFFT[i].im();
                double real7 = leftPressureSevendataFFT[i].re();
                leftPressureSevendataFFTAbs[i] = Math.hypot(real7, imag7) / leftTime.length;
                String y7 = String.valueOf(leftPressureSevendataFFTAbs[i]);
                leftPressureFFTY7.add(y7);

                double imag8 = leftPressureEightdataFFT[i].im();
                double real8 = leftPressureEightdataFFT[i].re();
                leftPressureEightdataFFTAbs[i] = Math.hypot(real8, imag8) / leftTime.length;
                String y8 = String.valueOf(leftPressureEightdataFFTAbs[i]);
                leftPressureFFTY8.add(y8);

                double imag9 = leftPressureNinedataFFT[i].im();
                double real9 = leftPressureNinedataFFT[i].re();
                leftPressureNinedataFFTAbs[i] = Math.hypot(real9, imag9) / leftTime.length;
                String y9 = String.valueOf(leftPressureNinedataFFTAbs[i]);
                leftPressureFFTY9.add(y9);
            }
            //System.out.println(leftPressureOnedataFFTAbs);
            List<String> XListFFT = FrequencyX;
            List<String> Y1ListFFT = leftPressureFFTY1;
            List<String> Y2ListFFT = leftPressureFFTY2;
            List<String> Y3ListFFT = leftPressureFFTY3;
            List<String> Y4ListFFT = leftPressureFFTY4;
            List<String> Y5ListFFT = leftPressureFFTY5;
            List<String> Y6ListFFT = leftPressureFFTY6;
            List<String> Y7ListFFT = leftPressureFFTY7;
            List<String> Y8ListFFT = leftPressureFFTY8;
            List<String> Y9ListFFT = leftPressureFFTY9;

            pictureData.put("FFT_x", XListFFT);
            pictureData.put("leftFoot1", Y1ListFFT);
            pictureData.put("leftFoot2", Y2ListFFT);
            pictureData.put("leftFoot3", Y3ListFFT);
            pictureData.put("leftFoot4", Y4ListFFT);
            pictureData.put("leftFoot5", Y5ListFFT);
            pictureData.put("leftFoot6", Y6ListFFT);
            pictureData.put("leftFoot7", Y7ListFFT);
            pictureData.put("leftFoot8", Y8ListFFT);
            pictureData.put("leftFoot9", Y9ListFFT);



            Map<Integer, List<String>> xyMapleftFFT1 = new HashMap<>();
            xyMapleftFFT1.put(0, XListFFT);
            xyMapleftFFT1.put(1, Y1ListFFT);
            Map<Integer, List<String>> xyMapleftFFT2 = new HashMap<>();
            xyMapleftFFT2.put(0, XListFFT);
            xyMapleftFFT2.put(1, Y2ListFFT);
            Map<Integer, List<String>> xyMapleftFFT3 = new HashMap<>();
            xyMapleftFFT3.put(0, XListFFT);
            xyMapleftFFT3.put(1, Y3ListFFT);
            Map<Integer, List<String>> xyMapleftFFT4 = new HashMap<>();
            xyMapleftFFT4.put(0, XListFFT);
            xyMapleftFFT4.put(1, Y4ListFFT);
            Map<Integer, List<String>> xyMapleftFFT5 = new HashMap<>();
            xyMapleftFFT5.put(0, XListFFT);
            xyMapleftFFT5.put(1, Y5ListFFT);
            Map<Integer, List<String>> xyMapleftFFT6 = new HashMap<>();
            xyMapleftFFT6.put(0, XListFFT);
            xyMapleftFFT6.put(1, Y6ListFFT);
            Map<Integer, List<String>> xyMapleftFFT7 = new HashMap<>();
            xyMapleftFFT7.put(0, XListFFT);
            xyMapleftFFT7.put(1, Y7ListFFT);
            Map<Integer, List<String>> xyMapleftFFT8 = new HashMap<>();
            xyMapleftFFT8.put(0, XListFFT);
            xyMapleftFFT8.put(1, Y8ListFFT);
            Map<Integer, List<String>> xyMapleftFFT9 = new HashMap<>();
            xyMapleftFFT9.put(0, XListFFT);
            xyMapleftFFT9.put(1, Y9ListFFT);

            /*left1*/
            {
                Map<String, Map<Integer, List<String>>> map = new HashMap<>();
                map.put("leftFoot1", xyMapleftFFT1);
                DefaultXYDataset xydataset = new DefaultXYDataset();
                for (Map.Entry<String, Map<Integer, List<String>>> entry : map.entrySet()) {
                    Map<Integer, List<String>> entryValue = entry.getValue();
                    int size = entryValue.get(0).size();
                    //数据集为二维数组
                    double[][] datas = new double[2][size / 20];
                    for (int i = 0; i < size / 20; i++) {
                        String xData = entryValue.get(0).get(i);
                        String yData = entryValue.get(1).get(i);
                        Double x = getFourDigits(xData);
                        Double y = getFourDigits(yData);
                        // 忽略坐标有null或者空字符串的情况
                        if (x == null || y == null) continue;
                        datas[0][i] = x;
                        datas[1][i] = y;
                    }
                    xydataset.addSeries(entry.getKey(), datas);
                }
                JFreeChart chart = ChartFactory.createScatterPlot("压力区域1-左脚", "f(Hz)", "|leftFootY1(f)|",
                        xydataset, PlotOrientation.VERTICAL, false, false, false);

                //解决中文乱码
                TextTitle textTitle =chart.getTitle();
                textTitle.setFont(new Font("宋体", Font.BOLD, 20));

                XYPlot xyplot = (XYPlot) chart.getPlot();
                xyplot.setBackgroundPaint(new Color(255, 253, 246));

                ValueAxis xAxis = xyplot.getDomainAxis();
                xAxis.setAxisLineStroke(new BasicStroke(1.5f)); // 坐标轴粗细
                xAxis.setAxisLinePaint(new Color(215, 215, 215)); // 坐标轴颜色
                xAxis.setLabelPaint(new Color(10, 10, 10)); // 坐标轴标题颜色
                xAxis.setTickLabelPaint(new Color(102, 102, 102)); // 坐标轴标尺值颜色
                xAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 12)); // 设置x轴的数值字体样式
                xAxis.setLabelFont(new Font("黑体", Font.BOLD, 14));

                ValueAxis yAxis = xyplot.getRangeAxis();
                yAxis.setAxisLineStroke(new BasicStroke(1.5f));
                yAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 12)); // 设置y轴的数值字体样式
                yAxis.setLabelFont(new Font("黑体", Font.BOLD, 14));


                XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
                renderer.setBaseShapesVisible(false); // series 点（即数据点）可见
                renderer.setBaseLinesVisible(true); // series 点（即数据点）间有连线可见
                renderer.setDrawSeriesLineAsPath(true);

                File file = new File(this.tempImageDir);
                if (!file.exists()) file.mkdir();
                String imagePath = this.tempImageDir + File.separator + "leftPressureOnedataFFT.jpg";
                fos = new FileOutputStream(imagePath);
                ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            }
            /*left2*/
            {
                Map<String, Map<Integer, List<String>>> map = new HashMap<>();
                map.put("leftFoot2", xyMapleftFFT2);
                DefaultXYDataset xydataset = new DefaultXYDataset();
                for (Map.Entry<String, Map<Integer, List<String>>> entry : map.entrySet()) {
                    Map<Integer, List<String>> entryValue = entry.getValue();
                    int size = entryValue.get(0).size();
                    //数据集为二维数组
                    double[][] datas = new double[2][size / 20];
                    for (int i = 0; i < size / 20; i++) {
                        String xData = entryValue.get(0).get(i);
                        String yData = entryValue.get(1).get(i);
                        Double x = getFourDigits(xData);
                        Double y = getFourDigits(yData);
                        // 忽略坐标有null或者空字符串的情况
                        if (x == null || y == null) continue;
                        datas[0][i] = x;
                        datas[1][i] = y;
                    }
                    xydataset.addSeries(entry.getKey(), datas);
                }
                JFreeChart chart = ChartFactory.createScatterPlot("压力区域2-左脚", "f(Hz)", "|leftFootY2(f)|",
                        xydataset, PlotOrientation.VERTICAL, false, false, false);

                //解决中文乱码
                TextTitle textTitle =chart.getTitle();
                textTitle.setFont(new Font("宋体", Font.BOLD, 20));

                XYPlot xyplot = (XYPlot) chart.getPlot();
                xyplot.setBackgroundPaint(new Color(255, 253, 246));

                ValueAxis xAxis = xyplot.getDomainAxis();
                xAxis.setAxisLineStroke(new BasicStroke(1.5f)); // 坐标轴粗细
                xAxis.setAxisLinePaint(new Color(215, 215, 215)); // 坐标轴颜色
                xAxis.setLabelPaint(new Color(10, 10, 10)); // 坐标轴标题颜色
                xAxis.setTickLabelPaint(new Color(102, 102, 102)); // 坐标轴标尺值颜色
                xAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 12)); // 设置x轴的数值字体样式
                xAxis.setLabelFont(new Font("黑体", Font.BOLD, 14));

                ValueAxis yAxis = xyplot.getRangeAxis();
                yAxis.setAxisLineStroke(new BasicStroke(1.5f));
                yAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 12)); // 设置y轴的数值字体样式
                yAxis.setLabelFont(new Font("黑体", Font.BOLD, 14));


                XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
                renderer.setBaseShapesVisible(false); // series 点（即数据点）可见
                renderer.setBaseLinesVisible(true); // series 点（即数据点）间有连线可见
                renderer.setDrawSeriesLineAsPath(true);

                File file = new File(this.tempImageDir);
                if (!file.exists()) file.mkdir();
                String imagePath = this.tempImageDir + File.separator + "leftPressureTwodataFFT.jpg";
                fos = new FileOutputStream(imagePath);
                ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            }
            /*left3*/
            {
                Map<String, Map<Integer, List<String>>> map = new HashMap<>();
                map.put("leftFoot3", xyMapleftFFT3);
                DefaultXYDataset xydataset = new DefaultXYDataset();
                for (Map.Entry<String, Map<Integer, List<String>>> entry : map.entrySet()) {
                    Map<Integer, List<String>> entryValue = entry.getValue();
                    int size = entryValue.get(0).size();
                    //数据集为二维数组
                    double[][] datas = new double[2][size / 20];
                    for (int i = 0; i < size / 20; i++) {
                        String xData = entryValue.get(0).get(i);
                        String yData = entryValue.get(1).get(i);
                        Double x = getFourDigits(xData);
                        Double y = getFourDigits(yData);
                        // 忽略坐标有null或者空字符串的情况
                        if (x == null || y == null) continue;
                        datas[0][i] = x;
                        datas[1][i] = y;
                    }
                    xydataset.addSeries(entry.getKey(), datas);
                }
                JFreeChart chart = ChartFactory.createScatterPlot("压力区域3-左脚", "f(Hz)", "|leftFootY3(f)|",
                        xydataset, PlotOrientation.VERTICAL, false, false, false);

                //解决中文乱码
                TextTitle textTitle =chart.getTitle();
                textTitle.setFont(new Font("宋体", Font.BOLD, 20));

                XYPlot xyplot = (XYPlot) chart.getPlot();
                xyplot.setBackgroundPaint(new Color(255, 253, 246));

                ValueAxis xAxis = xyplot.getDomainAxis();
                xAxis.setAxisLineStroke(new BasicStroke(1.5f)); // 坐标轴粗细
                xAxis.setAxisLinePaint(new Color(215, 215, 215)); // 坐标轴颜色
                xAxis.setLabelPaint(new Color(10, 10, 10)); // 坐标轴标题颜色
                xAxis.setTickLabelPaint(new Color(102, 102, 102)); // 坐标轴标尺值颜色
                xAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 12)); // 设置x轴的数值字体样式
                xAxis.setLabelFont(new Font("黑体", Font.BOLD, 14));

                ValueAxis yAxis = xyplot.getRangeAxis();
                yAxis.setAxisLineStroke(new BasicStroke(1.5f));
                yAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 12)); // 设置y轴的数值字体样式
                yAxis.setLabelFont(new Font("黑体", Font.BOLD, 14));


                XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
                renderer.setBaseShapesVisible(false); // series 点（即数据点）可见
                renderer.setBaseLinesVisible(true); // series 点（即数据点）间有连线可见
                renderer.setDrawSeriesLineAsPath(true);

                File file = new File(this.tempImageDir);
                if (!file.exists()) file.mkdir();
                String imagePath = this.tempImageDir + File.separator + "leftPressureThreedataFFT.jpg";
                fos = new FileOutputStream(imagePath);
                ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            }
            /*left4*/
            {
                Map<String, Map<Integer, List<String>>> map = new HashMap<>();
                map.put("leftFoot4", xyMapleftFFT4);
                DefaultXYDataset xydataset = new DefaultXYDataset();
                for (Map.Entry<String, Map<Integer, List<String>>> entry : map.entrySet()) {
                    Map<Integer, List<String>> entryValue = entry.getValue();
                    int size = entryValue.get(0).size();
                    //数据集为二维数组
                    double[][] datas = new double[2][size / 20];
                    for (int i = 0; i < size / 20; i++) {
                        String xData = entryValue.get(0).get(i);
                        String yData = entryValue.get(1).get(i);
                        Double x = getFourDigits(xData);
                        Double y = getFourDigits(yData);
                        // 忽略坐标有null或者空字符串的情况
                        if (x == null || y == null) continue;
                        datas[0][i] = x;
                        datas[1][i] = y;
                    }
                    xydataset.addSeries(entry.getKey(), datas);
                }
                JFreeChart chart = ChartFactory.createScatterPlot("压力区域4-左脚", "f(Hz)", "|leftFootY4(f)|",
                        xydataset, PlotOrientation.VERTICAL, false, false, false);

                //解决中文乱码
                TextTitle textTitle =chart.getTitle();
                textTitle.setFont(new Font("宋体", Font.BOLD, 20));

                XYPlot xyplot = (XYPlot) chart.getPlot();
                xyplot.setBackgroundPaint(new Color(255, 253, 246));

                ValueAxis xAxis = xyplot.getDomainAxis();
                xAxis.setAxisLineStroke(new BasicStroke(1.5f)); // 坐标轴粗细
                xAxis.setAxisLinePaint(new Color(215, 215, 215)); // 坐标轴颜色
                xAxis.setLabelPaint(new Color(10, 10, 10)); // 坐标轴标题颜色
                xAxis.setTickLabelPaint(new Color(102, 102, 102)); // 坐标轴标尺值颜色
                xAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 12)); // 设置x轴的数值字体样式
                xAxis.setLabelFont(new Font("黑体", Font.BOLD, 14));

                ValueAxis yAxis = xyplot.getRangeAxis();
                yAxis.setAxisLineStroke(new BasicStroke(1.5f));
                yAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 12)); // 设置y轴的数值字体样式
                yAxis.setLabelFont(new Font("黑体", Font.BOLD, 14));


                XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
                renderer.setBaseShapesVisible(false); // series 点（即数据点）可见
                renderer.setBaseLinesVisible(true); // series 点（即数据点）间有连线可见
                renderer.setDrawSeriesLineAsPath(true);

                File file = new File(this.tempImageDir);
                if (!file.exists()) file.mkdir();
                String imagePath = this.tempImageDir + File.separator + "leftPressureFourdataFFT.jpg";
                fos = new FileOutputStream(imagePath);
                ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            }
            /*left5*/
            {
                Map<String, Map<Integer, List<String>>> map = new HashMap<>();
                map.put("leftFoot5", xyMapleftFFT5);
                DefaultXYDataset xydataset = new DefaultXYDataset();
                for (Map.Entry<String, Map<Integer, List<String>>> entry : map.entrySet()) {
                    Map<Integer, List<String>> entryValue = entry.getValue();
                    int size = entryValue.get(0).size();
                    //数据集为二维数组
                    double[][] datas = new double[2][size / 20];
                    for (int i = 0; i < size / 20; i++) {
                        String xData = entryValue.get(0).get(i);
                        String yData = entryValue.get(1).get(i);
                        Double x = getFourDigits(xData);
                        Double y = getFourDigits(yData);
                        // 忽略坐标有null或者空字符串的情况
                        if (x == null || y == null) continue;
                        datas[0][i] = x;
                        datas[1][i] = y;
                    }
                    xydataset.addSeries(entry.getKey(), datas);
                }
                JFreeChart chart = ChartFactory.createScatterPlot("压力区域5-左脚", "f(Hz)", "|leftFootY5(f)|",
                        xydataset, PlotOrientation.VERTICAL, false, false, false);

                //解决中文乱码
                TextTitle textTitle =chart.getTitle();
                textTitle.setFont(new Font("宋体", Font.BOLD, 20));

                XYPlot xyplot = (XYPlot) chart.getPlot();
                xyplot.setBackgroundPaint(new Color(255, 253, 246));

                ValueAxis xAxis = xyplot.getDomainAxis();
                xAxis.setAxisLineStroke(new BasicStroke(1.5f)); // 坐标轴粗细
                xAxis.setAxisLinePaint(new Color(215, 215, 215)); // 坐标轴颜色
                xAxis.setLabelPaint(new Color(10, 10, 10)); // 坐标轴标题颜色
                xAxis.setTickLabelPaint(new Color(102, 102, 102)); // 坐标轴标尺值颜色
                xAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 12)); // 设置x轴的数值字体样式
                xAxis.setLabelFont(new Font("黑体", Font.BOLD, 14));

                ValueAxis yAxis = xyplot.getRangeAxis();
                yAxis.setAxisLineStroke(new BasicStroke(1.5f));
                yAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 12)); // 设置y轴的数值字体样式
                yAxis.setLabelFont(new Font("黑体", Font.BOLD, 14));


                XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
                renderer.setBaseShapesVisible(false); // series 点（即数据点）可见
                renderer.setBaseLinesVisible(true); // series 点（即数据点）间有连线可见
                renderer.setDrawSeriesLineAsPath(true);

                File file = new File(this.tempImageDir);
                if (!file.exists()) file.mkdir();
                String imagePath = this.tempImageDir + File.separator + "leftPressureFivedataFFT.jpg";
                fos = new FileOutputStream(imagePath);
                ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            }
            /*left6*/
            {
                Map<String, Map<Integer, List<String>>> map = new HashMap<>();
                map.put("leftFoot6", xyMapleftFFT6);
                DefaultXYDataset xydataset = new DefaultXYDataset();
                for (Map.Entry<String, Map<Integer, List<String>>> entry : map.entrySet()) {
                    Map<Integer, List<String>> entryValue = entry.getValue();
                    int size = entryValue.get(0).size();
                    //数据集为二维数组
                    double[][] datas = new double[2][size / 20];
                    for (int i = 0; i < size / 20; i++) {
                        String xData = entryValue.get(0).get(i);
                        String yData = entryValue.get(1).get(i);
                        Double x = getFourDigits(xData);
                        Double y = getFourDigits(yData);
                        // 忽略坐标有null或者空字符串的情况
                        if (x == null || y == null) continue;
                        datas[0][i] = x;
                        datas[1][i] = y;
                    }
                    xydataset.addSeries(entry.getKey(), datas);
                }
                JFreeChart chart = ChartFactory.createScatterPlot("压力区域6-左脚", "f(Hz)", "|leftFootY6(f)|",
                        xydataset, PlotOrientation.VERTICAL, false, false, false);

                //解决中文乱码
                TextTitle textTitle =chart.getTitle();
                textTitle.setFont(new Font("宋体", Font.BOLD, 20));

                XYPlot xyplot = (XYPlot) chart.getPlot();
                xyplot.setBackgroundPaint(new Color(255, 253, 246));

                ValueAxis xAxis = xyplot.getDomainAxis();
                xAxis.setAxisLineStroke(new BasicStroke(1.5f)); // 坐标轴粗细
                xAxis.setAxisLinePaint(new Color(215, 215, 215)); // 坐标轴颜色
                xAxis.setLabelPaint(new Color(10, 10, 10)); // 坐标轴标题颜色
                xAxis.setTickLabelPaint(new Color(102, 102, 102)); // 坐标轴标尺值颜色
                xAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 12)); // 设置x轴的数值字体样式
                xAxis.setLabelFont(new Font("黑体", Font.BOLD, 14));

                ValueAxis yAxis = xyplot.getRangeAxis();
                yAxis.setAxisLineStroke(new BasicStroke(1.5f));
                yAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 12)); // 设置y轴的数值字体样式
                yAxis.setLabelFont(new Font("黑体", Font.BOLD, 14));


                XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
                renderer.setBaseShapesVisible(false); // series 点（即数据点）可见
                renderer.setBaseLinesVisible(true); // series 点（即数据点）间有连线可见
                renderer.setDrawSeriesLineAsPath(true);

                File file = new File(this.tempImageDir);
                if (!file.exists()) file.mkdir();
                String imagePath = this.tempImageDir + File.separator + "leftPressureSixdataFFT.jpg";
                fos = new FileOutputStream(imagePath);
                ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            }
            /*left7*/
            {
                Map<String, Map<Integer, List<String>>> map = new HashMap<>();
                map.put("leftFoot7", xyMapleftFFT7);
                DefaultXYDataset xydataset = new DefaultXYDataset();
                for (Map.Entry<String, Map<Integer, List<String>>> entry : map.entrySet()) {
                    Map<Integer, List<String>> entryValue = entry.getValue();
                    int size = entryValue.get(0).size();
                    //数据集为二维数组
                    double[][] datas = new double[2][size / 20];
                    for (int i = 0; i < size / 20; i++) {
                        String xData = entryValue.get(0).get(i);
                        String yData = entryValue.get(1).get(i);
                        Double x = getFourDigits(xData);
                        Double y = getFourDigits(yData);
                        // 忽略坐标有null或者空字符串的情况
                        if (x == null || y == null) continue;
                        datas[0][i] = x;
                        datas[1][i] = y;
                    }
                    xydataset.addSeries(entry.getKey(), datas);
                }
                JFreeChart chart = ChartFactory.createScatterPlot("压力区域7-左脚", "f(Hz)", "|leftFootY7(f)|",
                        xydataset, PlotOrientation.VERTICAL, false, false, false);

                //解决中文乱码
                TextTitle textTitle =chart.getTitle();
                textTitle.setFont(new Font("宋体", Font.BOLD, 20));

                XYPlot xyplot = (XYPlot) chart.getPlot();
                xyplot.setBackgroundPaint(new Color(255, 253, 246));

                ValueAxis xAxis = xyplot.getDomainAxis();
                xAxis.setAxisLineStroke(new BasicStroke(1.5f)); // 坐标轴粗细
                xAxis.setAxisLinePaint(new Color(215, 215, 215)); // 坐标轴颜色
                xAxis.setLabelPaint(new Color(10, 10, 10)); // 坐标轴标题颜色
                xAxis.setTickLabelPaint(new Color(102, 102, 102)); // 坐标轴标尺值颜色
                xAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 12)); // 设置x轴的数值字体样式
                xAxis.setLabelFont(new Font("黑体", Font.BOLD, 14));

                ValueAxis yAxis = xyplot.getRangeAxis();
                yAxis.setAxisLineStroke(new BasicStroke(1.5f));
                yAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 12)); // 设置y轴的数值字体样式
                yAxis.setLabelFont(new Font("黑体", Font.BOLD, 14));


                XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
                renderer.setBaseShapesVisible(false); // series 点（即数据点）可见
                renderer.setBaseLinesVisible(true); // series 点（即数据点）间有连线可见
                renderer.setDrawSeriesLineAsPath(true);

                File file = new File(this.tempImageDir);
                if (!file.exists()) file.mkdir();
                String imagePath = this.tempImageDir + File.separator + "leftPressureSevendataFFT.jpg";
                fos = new FileOutputStream(imagePath);
                ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            }
            /*left8*/
            {
                Map<String, Map<Integer, List<String>>> map = new HashMap<>();
                map.put("leftFoot8", xyMapleftFFT8);
                DefaultXYDataset xydataset = new DefaultXYDataset();
                for (Map.Entry<String, Map<Integer, List<String>>> entry : map.entrySet()) {
                    Map<Integer, List<String>> entryValue = entry.getValue();
                    int size = entryValue.get(0).size();
                    //数据集为二维数组
                    double[][] datas = new double[2][size / 20];
                    for (int i = 0; i < size / 20; i++) {
                        String xData = entryValue.get(0).get(i);
                        String yData = entryValue.get(1).get(i);
                        Double x = getFourDigits(xData);
                        Double y = getFourDigits(yData);
                        // 忽略坐标有null或者空字符串的情况
                        if (x == null || y == null) continue;
                        datas[0][i] = x;
                        datas[1][i] = y;
                    }
                    xydataset.addSeries(entry.getKey(), datas);
                }
                JFreeChart chart = ChartFactory.createScatterPlot("压力区域8-左脚", "f(Hz)", "|leftFootY8(f)|",
                        xydataset, PlotOrientation.VERTICAL, false, false, false);

                //解决中文乱码
                TextTitle textTitle =chart.getTitle();
                textTitle.setFont(new Font("宋体", Font.BOLD, 20));

                XYPlot xyplot = (XYPlot) chart.getPlot();
                xyplot.setBackgroundPaint(new Color(255, 253, 246));

                ValueAxis xAxis = xyplot.getDomainAxis();
                xAxis.setAxisLineStroke(new BasicStroke(1.5f)); // 坐标轴粗细
                xAxis.setAxisLinePaint(new Color(215, 215, 215)); // 坐标轴颜色
                xAxis.setLabelPaint(new Color(10, 10, 10)); // 坐标轴标题颜色
                xAxis.setTickLabelPaint(new Color(102, 102, 102)); // 坐标轴标尺值颜色
                xAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 12)); // 设置x轴的数值字体样式
                xAxis.setLabelFont(new Font("黑体", Font.BOLD, 14));

                ValueAxis yAxis = xyplot.getRangeAxis();
                yAxis.setAxisLineStroke(new BasicStroke(1.5f));
                yAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 12)); // 设置y轴的数值字体样式
                yAxis.setLabelFont(new Font("黑体", Font.BOLD, 14));


                XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
                renderer.setBaseShapesVisible(false); // series 点（即数据点）可见
                renderer.setBaseLinesVisible(true); // series 点（即数据点）间有连线可见
                renderer.setDrawSeriesLineAsPath(true);

                File file = new File(this.tempImageDir);
                if (!file.exists()) file.mkdir();
                String imagePath = this.tempImageDir + File.separator + "leftPressureEightdataFFT.jpg";
                fos = new FileOutputStream(imagePath);
                ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            }
            /*left9*/
            {
                Map<String, Map<Integer, List<String>>> map = new HashMap<>();
                map.put("leftFoot9", xyMapleftFFT9);
                DefaultXYDataset xydataset = new DefaultXYDataset();
                for (Map.Entry<String, Map<Integer, List<String>>> entry : map.entrySet()) {
                    Map<Integer, List<String>> entryValue = entry.getValue();
                    int size = entryValue.get(0).size();
                    //数据集为二维数组
                    double[][] datas = new double[2][size / 20];
                    for (int i = 0; i < size / 20; i++) {
                        String xData = entryValue.get(0).get(i);
                        String yData = entryValue.get(1).get(i);
                        Double x = getFourDigits(xData);
                        Double y = getFourDigits(yData);
                        // 忽略坐标有null或者空字符串的情况
                        if (x == null || y == null) continue;
                        datas[0][i] = x;
                        datas[1][i] = y;
                    }
                    xydataset.addSeries(entry.getKey(), datas);
                }
                JFreeChart chart = ChartFactory.createScatterPlot("压力区域9-左脚", "f(Hz)", "|leftFootY9(f)|",
                        xydataset, PlotOrientation.VERTICAL, false, false, false);

                //解决中文乱码
                TextTitle textTitle =chart.getTitle();
                textTitle.setFont(new Font("宋体", Font.BOLD, 20));

                XYPlot xyplot = (XYPlot) chart.getPlot();
                xyplot.setBackgroundPaint(new Color(255, 253, 246));

                ValueAxis xAxis = xyplot.getDomainAxis();
                xAxis.setAxisLineStroke(new BasicStroke(1.5f)); // 坐标轴粗细
                xAxis.setAxisLinePaint(new Color(215, 215, 215)); // 坐标轴颜色
                xAxis.setLabelPaint(new Color(10, 10, 10)); // 坐标轴标题颜色
                xAxis.setTickLabelPaint(new Color(102, 102, 102)); // 坐标轴标尺值颜色
                xAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 12)); // 设置x轴的数值字体样式
                xAxis.setLabelFont(new Font("黑体", Font.BOLD, 14));

                ValueAxis yAxis = xyplot.getRangeAxis();
                yAxis.setAxisLineStroke(new BasicStroke(1.5f));
                yAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 12)); // 设置y轴的数值字体样式
                yAxis.setLabelFont(new Font("黑体", Font.BOLD, 14));


                XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
                renderer.setBaseShapesVisible(false); // series 点（即数据点）可见
                renderer.setBaseLinesVisible(true); // series 点（即数据点）间有连线可见
                renderer.setDrawSeriesLineAsPath(true);

                File file = new File(this.tempImageDir);
                if (!file.exists()) file.mkdir();
                String imagePath = this.tempImageDir + File.separator + "leftPressureNinedataFFT.jpg";
                fos = new FileOutputStream(imagePath);
                ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            }
            //右脚
            //右脚九个压力点
        {
            String[] rightTime1 = new String[csvListRight.size()];
            String[] rightPressureOnedata1 = new String[csvListRight.size()];
            String[] rightPressureTwodata1 = new String[csvListRight.size()];
            String[] rightPressureThreedata1 = new String[csvListRight.size()];
            String[] rightPressureFourdata1 = new String[csvListRight.size()];
            String[] rightPressureFivedata1 = new String[csvListRight.size()];
            String[] rightPressureSixdata1 = new String[csvListRight.size()];
            String[] rightPressureSevendata1 = new String[csvListRight.size()];
            String[] rightPressureEightdata1 = new String[csvListRight.size()];
            String[] rightPressureNinedata1 = new String[csvListRight.size()];
            for (int i = 0; i < csvListRight.size(); i++) {
                String[] item2 = csvListRight.get(i);
                rightTime1[i] = item2[0];                   //rightTime
                rightPressureOnedata1[i] = item2[1];      //rightPressureOnedata
                rightPressureTwodata1[i] = item2[2];      //rightPressureTwodata
                rightPressureThreedata1[i] = item2[3];    //rightPressureThreedata
                rightPressureFourdata1[i] = item2[4];     //rightPressureFourdata
                rightPressureFivedata1[i] = item2[5];     //rightPressureFivedata
                rightPressureSixdata1[i] = item2[6];      //rightPressureSixdata
                rightPressureSevendata1[i] = item2[7];    //rightPressureSevendata
                rightPressureEightdata1[i] = item2[8];    //rightPressureEightdata
                rightPressureNinedata1[i] = item2[9];     //rightPressureNinedata
            }

            //将string转化为double
            double[] rightTime = Arrays.asList(rightTime1).stream().mapToDouble(Double::parseDouble).toArray();
            double[] rightPressureOnedata = Arrays.asList(rightPressureOnedata1).stream().mapToDouble(Double::parseDouble).toArray();
            double[] rightPressureTwodata = Arrays.asList(rightPressureTwodata1).stream().mapToDouble(Double::parseDouble).toArray();
            double[] rightPressureThreedata = Arrays.asList(rightPressureThreedata1).stream().mapToDouble(Double::parseDouble).toArray();
            double[] rightPressureFourdata = Arrays.asList(rightPressureFourdata1).stream().mapToDouble(Double::parseDouble).toArray();
            double[] rightPressureFivedata = Arrays.asList(rightPressureFivedata1).stream().mapToDouble(Double::parseDouble).toArray();
            double[] rightPressureSixdata = Arrays.asList(rightPressureSixdata1).stream().mapToDouble(Double::parseDouble).toArray();
            double[] rightPressureSevendata = Arrays.asList(rightPressureSevendata1).stream().mapToDouble(Double::parseDouble).toArray();
            double[] rightPressureEightdata = Arrays.asList(rightPressureEightdata1).stream().mapToDouble(Double::parseDouble).toArray();
            double[] rightPressureNinedata = Arrays.asList(rightPressureNinedata1).stream().mapToDouble(Double::parseDouble).toArray();

            //定义右脚各压力点的复数
            Complex[] rightPressureOnedataComplex = new Complex[rightTime.length];
            Complex[] rightPressureTwodataComplex = new Complex[rightTime.length];
            Complex[] rightPressureThreedataComplex = new Complex[rightTime.length];
            Complex[] rightPressureFourdataComplex = new Complex[rightTime.length];
            Complex[] rightPressureFivedataComplex = new Complex[rightTime.length];
            Complex[] rightPressureSixdataComplex = new Complex[rightTime.length];
            Complex[] rightPressureSevendataComplex = new Complex[rightTime.length];
            Complex[] rightPressureEightdataComplex = new Complex[rightTime.length];
            Complex[] rightPressureNinedataComplex = new Complex[rightTime.length];



            //将double转化为comlex
            for (int i = 0; i < rightTime.length; i++) {
                rightPressureOnedataComplex[i] = new Complex(rightPressureOnedata[i], 0);
                rightPressureTwodataComplex[i] = new Complex(rightPressureTwodata[i], 0);
                rightPressureThreedataComplex[i] = new Complex(rightPressureThreedata[i], 0);
                rightPressureFourdataComplex[i] = new Complex(rightPressureFourdata[i], 0);
                rightPressureFivedataComplex[i] = new Complex(rightPressureFivedata[i], 0);
                rightPressureSixdataComplex[i] = new Complex(rightPressureSixdata[i], 0);
                rightPressureSevendataComplex[i] = new Complex(rightPressureSevendata[i], 0);
                rightPressureEightdataComplex[i] = new Complex(rightPressureEightdata[i], 0);
                rightPressureNinedataComplex[i] = new Complex(rightPressureNinedata[i], 0);

            }
            //右脚各压力点的fft
            Complex[] rightPressureOnedataFFT = fft(rightPressureOnedataComplex);
            Complex[] rightPressureTwodataFFT = fft(rightPressureTwodataComplex);
            Complex[] rightPressureThreedataFFT = fft(rightPressureThreedataComplex);
            Complex[] rightPressureFourdataFFT = fft(rightPressureFourdataComplex);
            Complex[] rightPressureFivedataFFT = fft(rightPressureFivedataComplex);
            Complex[] rightPressureSixdataFFT = fft(rightPressureSixdataComplex);
            Complex[] rightPressureSevendataFFT = fft(rightPressureSevendataComplex);
            Complex[] rightPressureEightdataFFT = fft(rightPressureEightdataComplex);
            Complex[] rightPressureNinedataFFT = fft(rightPressureNinedataComplex);

            //定义FFT的abs
            double[] rightPressureOnedataFFTAbs = new double[rightPressureOnedataFFT.length];
            double[] rightPressureTwodataFFTAbs = new double[rightPressureTwodataFFT.length];
            double[] rightPressureThreedataFFTAbs = new double[rightPressureThreedataFFT.length];
            double[] rightPressureFourdataFFTAbs = new double[rightPressureFourdataFFT.length];
            double[] rightPressureFivedataFFTAbs = new double[rightPressureFivedataFFT.length];
            double[] rightPressureSixdataFFTAbs = new double[rightPressureSixdataFFT.length];
            double[] rightPressureSevendataFFTAbs = new double[rightPressureSevendataFFT.length];
            double[] rightPressureEightdataFFTAbs = new double[rightPressureEightdataFFT.length];
            double[] rightPressureNinedataFFTAbs = new double[rightPressureNinedataFFT.length];
            List<String> Frequency1X = new ArrayList<>();
            List<String> rightPressureFFTY1 = new ArrayList<>();
            List<String> rightPressureFFTY2 = new ArrayList<>();
            List<String> rightPressureFFTY3 = new ArrayList<>();
            List<String> rightPressureFFTY4 = new ArrayList<>();
            List<String> rightPressureFFTY5 = new ArrayList<>();
            List<String> rightPressureFFTY6 = new ArrayList<>();
            List<String> rightPressureFFTY7 = new ArrayList<>();
            List<String> rightPressureFFTY8 = new ArrayList<>();
            List<String> rightPressureFFTY9 = new ArrayList<>();

            double samplingFrequency1 = 100;   //压力点抽样频率
            double len1 = rightTime.length;     //抽样点数
            double dFrequency1 = samplingFrequency1 / len1;    //单位抽样频率
            double[] Frequency1 = new double[rightTime.length]; //定义频率数组
            //取右脚各个压力fft的abs
            for (int i = 0; i < rightTime.length; i++) {
                Frequency1[i] = i * dFrequency1;
                double imag1 = rightPressureOnedataFFT[i].im();
                double real1 = rightPressureOnedataFFT[i].re();
                rightPressureOnedataFFTAbs[i] = Math.hypot(real1, imag1) / rightTime.length;
                String y1 = String.valueOf(rightPressureOnedataFFTAbs[i]);
                String x = String.valueOf(Frequency1[i]);
                rightPressureFFTY1.add(y1);
                Frequency1X.add(x);

                double imag2 = rightPressureTwodataFFT[i].im();
                double real2 = rightPressureTwodataFFT[i].re();
                rightPressureTwodataFFTAbs[i] = Math.hypot(real2, imag2) / rightTime.length;
                String y2 = String.valueOf(rightPressureTwodataFFTAbs[i]);
                rightPressureFFTY2.add(y2);

                double imag3 = rightPressureThreedataFFT[i].im();
                double real3 = rightPressureThreedataFFT[i].re();
                rightPressureThreedataFFTAbs[i] = Math.hypot(real3, imag3) / rightTime.length;
                String y3 = String.valueOf(rightPressureThreedataFFTAbs[i]);
                rightPressureFFTY3.add(y3);

                double imag4 = rightPressureFourdataFFT[i].im();
                double real4 = rightPressureFourdataFFT[i].re();
                rightPressureFourdataFFTAbs[i] = Math.hypot(real4, imag4) / rightTime.length;
                String y4 = String.valueOf(rightPressureFourdataFFTAbs[i]);
                rightPressureFFTY4.add(y4);

                double imag5 = rightPressureFivedataFFT[i].im();
                double real5 = rightPressureFivedataFFT[i].re();
                rightPressureFivedataFFTAbs[i] = Math.hypot(real5, imag5) / rightTime.length;
                String y5 = String.valueOf(rightPressureFivedataFFTAbs[i]);
                rightPressureFFTY5.add(y5);

                double imag6 = rightPressureSixdataFFT[i].im();
                double real6 = rightPressureSixdataFFT[i].re();
                rightPressureSixdataFFTAbs[i] = Math.hypot(real6, imag6) / rightTime.length;
                String y6 = String.valueOf(rightPressureSixdataFFTAbs[i]);
                rightPressureFFTY6.add(y6);

                double imag7 = rightPressureSevendataFFT[i].im();
                double real7 = rightPressureSevendataFFT[i].re();
                rightPressureSevendataFFTAbs[i] = Math.hypot(real7, imag7) / rightTime.length;
                String y7 = String.valueOf(rightPressureSevendataFFTAbs[i]);
                rightPressureFFTY7.add(y7);

                double imag8 = rightPressureEightdataFFT[i].im();
                double real8 = rightPressureEightdataFFT[i].re();
                rightPressureEightdataFFTAbs[i] = Math.hypot(real8, imag8) / rightTime.length;
                String y8 = String.valueOf(rightPressureEightdataFFTAbs[i]);
                rightPressureFFTY8.add(y8);

                double imag9 = rightPressureNinedataFFT[i].im();
                double real9 = rightPressureNinedataFFT[i].re();
                rightPressureNinedataFFTAbs[i] = Math.hypot(real9, imag9) / rightTime.length;
                String y9 = String.valueOf(rightPressureNinedataFFTAbs[i]);
                rightPressureFFTY9.add(y9);
            }
            //System.out.println(leftPressureOnedataFFTAbs);
            List<String> XrightListFFT = Frequency1X;
            List<String> Y1rightListFFT = rightPressureFFTY1;
            List<String> Y2rightListFFT = rightPressureFFTY2;
            List<String> Y3rightListFFT = rightPressureFFTY3;
            List<String> Y4rightListFFT = rightPressureFFTY4;
            List<String> Y5rightListFFT = rightPressureFFTY5;
            List<String> Y6rightListFFT = rightPressureFFTY6;
            List<String> Y7rightListFFT = rightPressureFFTY7;
            List<String> Y8rightListFFT = rightPressureFFTY8;
            List<String> Y9rightListFFT = rightPressureFFTY9;

            pictureData.put("FFT_x", XrightListFFT);
            pictureData.put("rightFoot1", Y1rightListFFT);
            pictureData.put("rightFoot2", Y2rightListFFT);
            pictureData.put("rightFoot3", Y3rightListFFT);
            pictureData.put("rightFoot4", Y4rightListFFT);
            pictureData.put("rightFoot5", Y5rightListFFT);
            pictureData.put("rightFoot6", Y6rightListFFT);
            pictureData.put("rightFoot7", Y7rightListFFT);
            pictureData.put("rightFoot8", Y8rightListFFT);
            pictureData.put("rightFoot9", Y9rightListFFT);



            Map<Integer, List<String>> xyMaprightFFT1 = new HashMap<>();
            xyMaprightFFT1.put(0, XListFFT);
            xyMaprightFFT1.put(1, Y1rightListFFT);
            Map<Integer, List<String>> xyMaprightFFT2 = new HashMap<>();
            xyMaprightFFT2.put(0, XListFFT);
            xyMaprightFFT2.put(1, Y2rightListFFT);
            Map<Integer, List<String>> xyMaprightFFT3 = new HashMap<>();
            xyMaprightFFT3.put(0, XListFFT);
            xyMaprightFFT3.put(1, Y3rightListFFT);
            Map<Integer, List<String>> xyMaprightFFT4 = new HashMap<>();
            xyMaprightFFT4.put(0, XListFFT);
            xyMaprightFFT4.put(1, Y4rightListFFT);
            Map<Integer, List<String>> xyMaprightFFT5 = new HashMap<>();
            xyMaprightFFT5.put(0, XListFFT);
            xyMaprightFFT5.put(1, Y5rightListFFT);
            Map<Integer, List<String>> xyMaprightFFT6 = new HashMap<>();
            xyMaprightFFT6.put(0, XListFFT);
            xyMaprightFFT6.put(1, Y6rightListFFT);
            Map<Integer, List<String>> xyMaprightFFT7 = new HashMap<>();
            xyMaprightFFT7.put(0, XListFFT);
            xyMaprightFFT7.put(1, Y7rightListFFT);
            Map<Integer, List<String>> xyMaprightFFT8 = new HashMap<>();
            xyMaprightFFT8.put(0, XListFFT);
            xyMaprightFFT8.put(1, Y8rightListFFT);
            Map<Integer, List<String>> xyMaprightFFT9 = new HashMap<>();
            xyMaprightFFT9.put(0, XListFFT);
            xyMaprightFFT9.put(1, Y9rightListFFT);

            /*right1*/
            {
                Map<String, Map<Integer, List<String>>> map = new HashMap<>();
                map.put("rightFoot1", xyMaprightFFT1);
                DefaultXYDataset xydataset = new DefaultXYDataset();
                for (Map.Entry<String, Map<Integer, List<String>>> entry : map.entrySet()) {
                    Map<Integer, List<String>> entryValue = entry.getValue();
                    int size = entryValue.get(0).size();
                    //数据集为二维数组
                    double[][] datas = new double[2][size / 20];
                    for (int i = 0; i < size / 20; i++) {
                        String xData = entryValue.get(0).get(i);
                        String yData = entryValue.get(1).get(i);
                        Double x = getFourDigits(xData);
                        Double y = getFourDigits(yData);
                        // 忽略坐标有null或者空字符串的情况
                        if (x == null || y == null) continue;
                        datas[0][i] = x;
                        datas[1][i] = y;
                    }
                    xydataset.addSeries(entry.getKey(), datas);
                }
                JFreeChart chart = ChartFactory.createScatterPlot("压力区域1-右脚", "f(Hz)", "|rightFootY1(f)|",
                        xydataset, PlotOrientation.VERTICAL, false, false, false);

                //解决中文乱码
                TextTitle textTitle =chart.getTitle();
                textTitle.setFont(new Font("宋体", Font.BOLD, 20));

                XYPlot xyplot = (XYPlot) chart.getPlot();
                xyplot.setBackgroundPaint(new Color(255, 253, 246));

                ValueAxis xAxis = xyplot.getDomainAxis();
                xAxis.setAxisLineStroke(new BasicStroke(1.5f)); // 坐标轴粗细
                xAxis.setAxisLinePaint(new Color(215, 215, 215)); // 坐标轴颜色
                xAxis.setLabelPaint(new Color(10, 10, 10)); // 坐标轴标题颜色
                xAxis.setTickLabelPaint(new Color(102, 102, 102)); // 坐标轴标尺值颜色
                xAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 12)); // 设置x轴的数值字体样式
                xAxis.setLabelFont(new Font("黑体", Font.BOLD, 14));

                ValueAxis yAxis = xyplot.getRangeAxis();
                yAxis.setAxisLineStroke(new BasicStroke(1.5f));
                yAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 12)); // 设置y轴的数值字体样式
                yAxis.setLabelFont(new Font("黑体", Font.BOLD, 14));


                XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
                renderer.setBaseShapesVisible(false); // series 点（即数据点）可见
                renderer.setBaseLinesVisible(true); // series 点（即数据点）间有连线可见
                renderer.setDrawSeriesLineAsPath(true);

                File file = new File(this.tempImageDir);
                if (!file.exists()) file.mkdir();
                String imagePath = this.tempImageDir + File.separator + "rightPressureOnedataFFT.jpg";
                fos = new FileOutputStream(imagePath);
                ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            }
            /*right2*/
            {
                Map<String, Map<Integer, List<String>>> map = new HashMap<>();
                map.put("rightFoot2", xyMaprightFFT2);
                DefaultXYDataset xydataset = new DefaultXYDataset();
                for (Map.Entry<String, Map<Integer, List<String>>> entry : map.entrySet()) {
                    Map<Integer, List<String>> entryValue = entry.getValue();
                    int size = entryValue.get(0).size();
                    //数据集为二维数组
                    double[][] datas = new double[2][size / 20];
                    for (int i = 0; i < size / 20; i++) {
                        String xData = entryValue.get(0).get(i);
                        String yData = entryValue.get(1).get(i);
                        Double x = getFourDigits(xData);
                        Double y = getFourDigits(yData);
                        // 忽略坐标有null或者空字符串的情况
                        if (x == null || y == null) continue;
                        datas[0][i] = x;
                        datas[1][i] = y;
                    }
                    xydataset.addSeries(entry.getKey(), datas);
                }
                JFreeChart chart = ChartFactory.createScatterPlot("压力区域2-右脚", "f(Hz)", "|rightFootY2(f)|",
                        xydataset, PlotOrientation.VERTICAL, false, false, false);

                //解决中文乱码
                TextTitle textTitle =chart.getTitle();
                textTitle.setFont(new Font("宋体", Font.BOLD, 20));

                XYPlot xyplot = (XYPlot) chart.getPlot();
                xyplot.setBackgroundPaint(new Color(255, 253, 246));

                ValueAxis xAxis = xyplot.getDomainAxis();
                xAxis.setAxisLineStroke(new BasicStroke(1.5f)); // 坐标轴粗细
                xAxis.setAxisLinePaint(new Color(215, 215, 215)); // 坐标轴颜色
                xAxis.setLabelPaint(new Color(10, 10, 10)); // 坐标轴标题颜色
                xAxis.setTickLabelPaint(new Color(102, 102, 102)); // 坐标轴标尺值颜色
                xAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 12)); // 设置x轴的数值字体样式
                xAxis.setLabelFont(new Font("黑体", Font.BOLD, 14));

                ValueAxis yAxis = xyplot.getRangeAxis();
                yAxis.setAxisLineStroke(new BasicStroke(1.5f));
                yAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 12)); // 设置y轴的数值字体样式
                yAxis.setLabelFont(new Font("黑体", Font.BOLD, 14));


                XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
                renderer.setBaseShapesVisible(false); // series 点（即数据点）可见
                renderer.setBaseLinesVisible(true); // series 点（即数据点）间有连线可见
                renderer.setDrawSeriesLineAsPath(true);

                File file = new File(this.tempImageDir);
                if (!file.exists()) file.mkdir();
                String imagePath = this.tempImageDir + File.separator + "rightPressureTwodataFFT.jpg";
                fos = new FileOutputStream(imagePath);
                ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            }
            /*right3*/
            {
                Map<String, Map<Integer, List<String>>> map = new HashMap<>();
                map.put("rightFoot3", xyMaprightFFT3);
                DefaultXYDataset xydataset = new DefaultXYDataset();
                for (Map.Entry<String, Map<Integer, List<String>>> entry : map.entrySet()) {
                    Map<Integer, List<String>> entryValue = entry.getValue();
                    int size = entryValue.get(0).size();
                    //数据集为二维数组
                    double[][] datas = new double[2][size / 20];
                    for (int i = 0; i < size / 20; i++) {
                        String xData = entryValue.get(0).get(i);
                        String yData = entryValue.get(1).get(i);
                        Double x = getFourDigits(xData);
                        Double y = getFourDigits(yData);
                        // 忽略坐标有null或者空字符串的情况
                        if (x == null || y == null) continue;
                        datas[0][i] = x;
                        datas[1][i] = y;
                    }
                    xydataset.addSeries(entry.getKey(), datas);
                }
                JFreeChart chart = ChartFactory.createScatterPlot("压力区域3-右脚", "f(Hz)", "|rightFootY3(f)|",
                        xydataset, PlotOrientation.VERTICAL, false, false, false);

                //解决中文乱码
                TextTitle textTitle =chart.getTitle();
                textTitle.setFont(new Font("宋体", Font.BOLD, 20));

                XYPlot xyplot = (XYPlot) chart.getPlot();
                xyplot.setBackgroundPaint(new Color(255, 253, 246));

                ValueAxis xAxis = xyplot.getDomainAxis();
                xAxis.setAxisLineStroke(new BasicStroke(1.5f)); // 坐标轴粗细
                xAxis.setAxisLinePaint(new Color(215, 215, 215)); // 坐标轴颜色
                xAxis.setLabelPaint(new Color(10, 10, 10)); // 坐标轴标题颜色
                xAxis.setTickLabelPaint(new Color(102, 102, 102)); // 坐标轴标尺值颜色
                xAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 12)); // 设置x轴的数值字体样式
                xAxis.setLabelFont(new Font("黑体", Font.BOLD, 14));

                ValueAxis yAxis = xyplot.getRangeAxis();
                yAxis.setAxisLineStroke(new BasicStroke(1.5f));
                yAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 12)); // 设置y轴的数值字体样式
                yAxis.setLabelFont(new Font("黑体", Font.BOLD, 14));


                XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
                renderer.setBaseShapesVisible(false); // series 点（即数据点）可见
                renderer.setBaseLinesVisible(true); // series 点（即数据点）间有连线可见
                renderer.setDrawSeriesLineAsPath(true);

                File file = new File(this.tempImageDir);
                if (!file.exists()) file.mkdir();
                String imagePath = this.tempImageDir + File.separator + "rightPressureThreedataFFT.jpg";
                fos = new FileOutputStream(imagePath);
                ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            }
            /*right4*/
            {
                Map<String, Map<Integer, List<String>>> map = new HashMap<>();
                map.put("rightFoot4", xyMaprightFFT4);
                DefaultXYDataset xydataset = new DefaultXYDataset();
                for (Map.Entry<String, Map<Integer, List<String>>> entry : map.entrySet()) {
                    Map<Integer, List<String>> entryValue = entry.getValue();
                    int size = entryValue.get(0).size();
                    //数据集为二维数组
                    double[][] datas = new double[2][size / 20];
                    for (int i = 0; i < size / 20; i++) {
                        String xData = entryValue.get(0).get(i);
                        String yData = entryValue.get(1).get(i);
                        Double x = getFourDigits(xData);
                        Double y = getFourDigits(yData);
                        // 忽略坐标有null或者空字符串的情况
                        if (x == null || y == null) continue;
                        datas[0][i] = x;
                        datas[1][i] = y;
                    }
                    xydataset.addSeries(entry.getKey(), datas);
                }
                JFreeChart chart = ChartFactory.createScatterPlot("压力区域4-右脚", "f(Hz)", "|rightFootY4(f)|",
                        xydataset, PlotOrientation.VERTICAL, false, false, false);

                //解决中文乱码
                TextTitle textTitle =chart.getTitle();
                textTitle.setFont(new Font("宋体", Font.BOLD, 20));

                XYPlot xyplot = (XYPlot) chart.getPlot();
                xyplot.setBackgroundPaint(new Color(255, 253, 246));

                ValueAxis xAxis = xyplot.getDomainAxis();
                xAxis.setAxisLineStroke(new BasicStroke(1.5f)); // 坐标轴粗细
                xAxis.setAxisLinePaint(new Color(215, 215, 215)); // 坐标轴颜色
                xAxis.setLabelPaint(new Color(10, 10, 10)); // 坐标轴标题颜色
                xAxis.setTickLabelPaint(new Color(102, 102, 102)); // 坐标轴标尺值颜色
                xAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 12)); // 设置x轴的数值字体样式
                xAxis.setLabelFont(new Font("黑体", Font.BOLD, 14));

                ValueAxis yAxis = xyplot.getRangeAxis();
                yAxis.setAxisLineStroke(new BasicStroke(1.5f));
                yAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 12)); // 设置y轴的数值字体样式
                yAxis.setLabelFont(new Font("黑体", Font.BOLD, 14));


                XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
                renderer.setBaseShapesVisible(false); // series 点（即数据点）可见
                renderer.setBaseLinesVisible(true); // series 点（即数据点）间有连线可见
                renderer.setDrawSeriesLineAsPath(true);

                File file = new File(this.tempImageDir);
                if (!file.exists()) file.mkdir();
                String imagePath = this.tempImageDir + File.separator + "rightPressureFourdataFFT.jpg";
                fos = new FileOutputStream(imagePath);
                ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            }
            /*right5*/
            {
                Map<String, Map<Integer, List<String>>> map = new HashMap<>();
                map.put("rightFoot5", xyMaprightFFT5);
                DefaultXYDataset xydataset = new DefaultXYDataset();
                for (Map.Entry<String, Map<Integer, List<String>>> entry : map.entrySet()) {
                    Map<Integer, List<String>> entryValue = entry.getValue();
                    int size = entryValue.get(0).size();
                    //数据集为二维数组
                    double[][] datas = new double[2][size / 20];
                    for (int i = 0; i < size / 20; i++) {
                        String xData = entryValue.get(0).get(i);
                        String yData = entryValue.get(1).get(i);
                        Double x = getFourDigits(xData);
                        Double y = getFourDigits(yData);
                        // 忽略坐标有null或者空字符串的情况
                        if (x == null || y == null) continue;
                        datas[0][i] = x;
                        datas[1][i] = y;
                    }
                    xydataset.addSeries(entry.getKey(), datas);
                }
                JFreeChart chart = ChartFactory.createScatterPlot("压力区域5-右脚", "f(Hz)", "|rightFootY5(f)|",
                        xydataset, PlotOrientation.VERTICAL, false, false, false);

                //解决中文乱码
                TextTitle textTitle =chart.getTitle();
                textTitle.setFont(new Font("宋体", Font.BOLD, 20));

                XYPlot xyplot = (XYPlot) chart.getPlot();
                xyplot.setBackgroundPaint(new Color(255, 253, 246));

                ValueAxis xAxis = xyplot.getDomainAxis();
                xAxis.setAxisLineStroke(new BasicStroke(1.5f)); // 坐标轴粗细
                xAxis.setAxisLinePaint(new Color(215, 215, 215)); // 坐标轴颜色
                xAxis.setLabelPaint(new Color(10, 10, 10)); // 坐标轴标题颜色
                xAxis.setTickLabelPaint(new Color(102, 102, 102)); // 坐标轴标尺值颜色
                xAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 12)); // 设置x轴的数值字体样式
                xAxis.setLabelFont(new Font("黑体", Font.BOLD, 14));

                ValueAxis yAxis = xyplot.getRangeAxis();
                yAxis.setAxisLineStroke(new BasicStroke(1.5f));
                yAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 12)); // 设置y轴的数值字体样式
                yAxis.setLabelFont(new Font("黑体", Font.BOLD, 14));


                XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
                renderer.setBaseShapesVisible(false); // series 点（即数据点）可见
                renderer.setBaseLinesVisible(true); // series 点（即数据点）间有连线可见
                renderer.setDrawSeriesLineAsPath(true);

                File file = new File(this.tempImageDir);
                if (!file.exists()) file.mkdir();
                String imagePath = this.tempImageDir + File.separator + "rightPressureFivedataFFT.jpg";
                fos = new FileOutputStream(imagePath);
                ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            }
            /*right6*/
            {
                Map<String, Map<Integer, List<String>>> map = new HashMap<>();
                map.put("rightFoot6", xyMaprightFFT6);
                DefaultXYDataset xydataset = new DefaultXYDataset();
                for (Map.Entry<String, Map<Integer, List<String>>> entry : map.entrySet()) {
                    Map<Integer, List<String>> entryValue = entry.getValue();
                    int size = entryValue.get(0).size();
                    //数据集为二维数组
                    double[][] datas = new double[2][size / 20];
                    for (int i = 0; i < size / 20; i++) {
                        String xData = entryValue.get(0).get(i);
                        String yData = entryValue.get(1).get(i);
                        Double x = getFourDigits(xData);
                        Double y = getFourDigits(yData);
                        // 忽略坐标有null或者空字符串的情况
                        if (x == null || y == null) continue;
                        datas[0][i] = x;
                        datas[1][i] = y;
                    }
                    xydataset.addSeries(entry.getKey(), datas);
                }
                JFreeChart chart = ChartFactory.createScatterPlot("压力区域6-右脚", "f(Hz)", "|rightFootY6(f)|",
                        xydataset, PlotOrientation.VERTICAL, false, false, false);

                //解决中文乱码
                TextTitle textTitle =chart.getTitle();
                textTitle.setFont(new Font("宋体", Font.BOLD, 20));

                XYPlot xyplot = (XYPlot) chart.getPlot();
                xyplot.setBackgroundPaint(new Color(255, 253, 246));

                ValueAxis xAxis = xyplot.getDomainAxis();
                xAxis.setAxisLineStroke(new BasicStroke(1.5f)); // 坐标轴粗细
                xAxis.setAxisLinePaint(new Color(215, 215, 215)); // 坐标轴颜色
                xAxis.setLabelPaint(new Color(10, 10, 10)); // 坐标轴标题颜色
                xAxis.setTickLabelPaint(new Color(102, 102, 102)); // 坐标轴标尺值颜色
                xAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 12)); // 设置x轴的数值字体样式
                xAxis.setLabelFont(new Font("黑体", Font.BOLD, 14));

                ValueAxis yAxis = xyplot.getRangeAxis();
                yAxis.setAxisLineStroke(new BasicStroke(1.5f));
                yAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 12)); // 设置y轴的数值字体样式
                yAxis.setLabelFont(new Font("黑体", Font.BOLD, 14));


                XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
                renderer.setBaseShapesVisible(false); // series 点（即数据点）可见
                renderer.setBaseLinesVisible(true); // series 点（即数据点）间有连线可见
                renderer.setDrawSeriesLineAsPath(true);

                File file = new File(this.tempImageDir);
                if (!file.exists()) file.mkdir();
                String imagePath = this.tempImageDir + File.separator + "rightPressureSixdataFFT.jpg";
                fos = new FileOutputStream(imagePath);
                ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            }
            /*right7*/
            {
                Map<String, Map<Integer, List<String>>> map = new HashMap<>();
                map.put("rightFoot7", xyMaprightFFT7);
                DefaultXYDataset xydataset = new DefaultXYDataset();
                for (Map.Entry<String, Map<Integer, List<String>>> entry : map.entrySet()) {
                    Map<Integer, List<String>> entryValue = entry.getValue();
                    int size = entryValue.get(0).size();
                    //数据集为二维数组
                    double[][] datas = new double[2][size / 20];
                    for (int i = 0; i < size / 20; i++) {
                        String xData = entryValue.get(0).get(i);
                        String yData = entryValue.get(1).get(i);
                        Double x = getFourDigits(xData);
                        Double y = getFourDigits(yData);
                        // 忽略坐标有null或者空字符串的情况
                        if (x == null || y == null) continue;
                        datas[0][i] = x;
                        datas[1][i] = y;
                    }
                    xydataset.addSeries(entry.getKey(), datas);
                }
                JFreeChart chart = ChartFactory.createScatterPlot("压力区域7-右脚", "f(Hz)", "|rightFootY7(f)|",
                        xydataset, PlotOrientation.VERTICAL, false, false, false);

                //解决中文乱码
                TextTitle textTitle =chart.getTitle();
                textTitle.setFont(new Font("宋体", Font.BOLD, 20));

                XYPlot xyplot = (XYPlot) chart.getPlot();
                xyplot.setBackgroundPaint(new Color(255, 253, 246));

                ValueAxis xAxis = xyplot.getDomainAxis();
                xAxis.setAxisLineStroke(new BasicStroke(1.5f)); // 坐标轴粗细
                xAxis.setAxisLinePaint(new Color(215, 215, 215)); // 坐标轴颜色
                xAxis.setLabelPaint(new Color(10, 10, 10)); // 坐标轴标题颜色
                xAxis.setTickLabelPaint(new Color(102, 102, 102)); // 坐标轴标尺值颜色
                xAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 12)); // 设置x轴的数值字体样式
                xAxis.setLabelFont(new Font("黑体", Font.BOLD, 14));

                ValueAxis yAxis = xyplot.getRangeAxis();
                yAxis.setAxisLineStroke(new BasicStroke(1.5f));
                yAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 12)); // 设置y轴的数值字体样式
                yAxis.setLabelFont(new Font("黑体", Font.BOLD, 14));


                XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
                renderer.setBaseShapesVisible(false); // series 点（即数据点）可见
                renderer.setBaseLinesVisible(true); // series 点（即数据点）间有连线可见
                renderer.setDrawSeriesLineAsPath(true);

                File file = new File(this.tempImageDir);
                if (!file.exists()) file.mkdir();
                String imagePath = this.tempImageDir + File.separator + "rightPressureSevendataFFT.jpg";
                fos = new FileOutputStream(imagePath);
                ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            }
            /*right8*/
            {
                Map<String, Map<Integer, List<String>>> map = new HashMap<>();
                map.put("rightFoot8", xyMaprightFFT8);
                DefaultXYDataset xydataset = new DefaultXYDataset();
                for (Map.Entry<String, Map<Integer, List<String>>> entry : map.entrySet()) {
                    Map<Integer, List<String>> entryValue = entry.getValue();
                    int size = entryValue.get(0).size();
                    //数据集为二维数组
                    double[][] datas = new double[2][size / 20];
                    for (int i = 0; i < size / 20; i++) {
                        String xData = entryValue.get(0).get(i);
                        String yData = entryValue.get(1).get(i);
                        Double x = getFourDigits(xData);
                        Double y = getFourDigits(yData);
                        // 忽略坐标有null或者空字符串的情况
                        if (x == null || y == null) continue;
                        datas[0][i] = x;
                        datas[1][i] = y;
                    }
                    xydataset.addSeries(entry.getKey(), datas);
                }
                JFreeChart chart = ChartFactory.createScatterPlot("压力区域8-右脚", "f(Hz)", "|rightFootY8(f)|",
                        xydataset, PlotOrientation.VERTICAL, false, false, false);

                //解决中文乱码
                TextTitle textTitle =chart.getTitle();
                textTitle.setFont(new Font("宋体", Font.BOLD, 20));

                XYPlot xyplot = (XYPlot) chart.getPlot();
                xyplot.setBackgroundPaint(new Color(255, 253, 246));

                ValueAxis xAxis = xyplot.getDomainAxis();
                xAxis.setAxisLineStroke(new BasicStroke(1.5f)); // 坐标轴粗细
                xAxis.setAxisLinePaint(new Color(215, 215, 215)); // 坐标轴颜色
                xAxis.setLabelPaint(new Color(10, 10, 10)); // 坐标轴标题颜色
                xAxis.setTickLabelPaint(new Color(102, 102, 102)); // 坐标轴标尺值颜色
                xAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 12)); // 设置x轴的数值字体样式
                xAxis.setLabelFont(new Font("黑体", Font.BOLD, 14));

                ValueAxis yAxis = xyplot.getRangeAxis();
                yAxis.setAxisLineStroke(new BasicStroke(1.5f));
                yAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 12)); // 设置y轴的数值字体样式
                yAxis.setLabelFont(new Font("黑体", Font.BOLD, 14));


                XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
                renderer.setBaseShapesVisible(false); // series 点（即数据点）可见
                renderer.setBaseLinesVisible(true); // series 点（即数据点）间有连线可见
                renderer.setDrawSeriesLineAsPath(true);

                File file = new File(this.tempImageDir);
                if (!file.exists()) file.mkdir();
                String imagePath = this.tempImageDir + File.separator + "rightPressureEightdataFFT.jpg";
                fos = new FileOutputStream(imagePath);
                ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            }
            /*right9*/
            {
                Map<String, Map<Integer, List<String>>> map = new HashMap<>();
                map.put("rightFoot9", xyMaprightFFT9);
                DefaultXYDataset xydataset = new DefaultXYDataset();
                for (Map.Entry<String, Map<Integer, List<String>>> entry : map.entrySet()) {
                    Map<Integer, List<String>> entryValue = entry.getValue();
                    int size = entryValue.get(0).size();
                    //数据集为二维数组
                    double[][] datas = new double[2][size / 20];
                    for (int i = 0; i < size / 20; i++) {
                        String xData = entryValue.get(0).get(i);
                        String yData = entryValue.get(1).get(i);
                        Double x = getFourDigits(xData);
                        Double y = getFourDigits(yData);
                        // 忽略坐标有null或者空字符串的情况
                        if (x == null || y == null) continue;
                        datas[0][i] = x;
                        datas[1][i] = y;
                    }
                    xydataset.addSeries(entry.getKey(), datas);
                }
                JFreeChart chart = ChartFactory.createScatterPlot("压力区域9-右脚", "f(Hz)", "|rightFootY9(f)|",
                        xydataset, PlotOrientation.VERTICAL, false, false, false);

                //解决中文乱码
                TextTitle textTitle =chart.getTitle();
                textTitle.setFont(new Font("宋体", Font.BOLD, 20));

                XYPlot xyplot = (XYPlot) chart.getPlot();
                xyplot.setBackgroundPaint(new Color(255, 253, 246));

                ValueAxis xAxis = xyplot.getDomainAxis();
                xAxis.setAxisLineStroke(new BasicStroke(1.5f)); // 坐标轴粗细
                xAxis.setAxisLinePaint(new Color(215, 215, 215)); // 坐标轴颜色
                xAxis.setLabelPaint(new Color(10, 10, 10)); // 坐标轴标题颜色
                xAxis.setTickLabelPaint(new Color(102, 102, 102)); // 坐标轴标尺值颜色
                xAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 12)); // 设置x轴的数值字体样式
                xAxis.setLabelFont(new Font("黑体", Font.BOLD, 14));

                ValueAxis yAxis = xyplot.getRangeAxis();
                yAxis.setAxisLineStroke(new BasicStroke(1.5f));
                yAxis.setTickLabelFont(new Font("黑体", Font.BOLD, 12)); // 设置y轴的数值字体样式
                yAxis.setLabelFont(new Font("黑体", Font.BOLD, 14));


                XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
                renderer.setBaseShapesVisible(false); // series 点（即数据点）可见
                renderer.setBaseLinesVisible(true); // series 点（即数据点）间有连线可见
                renderer.setDrawSeriesLineAsPath(true);

                File file = new File(this.tempImageDir);
                if (!file.exists()) file.mkdir();
                String imagePath = this.tempImageDir + File.separator + "rightPressureNinedataFFT.jpg";
                fos = new FileOutputStream(imagePath);
                ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            }
        }
            return true;
        } catch (IOException e) {
            e.printStackTrace();
            return false;
        } finally {
            try {
                if (fos != null) fos.close();

            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    /**生成前中后足的区域比值图   "offset.jpg"
     * @param featureData
     * @param width
     * @param height
     */
    private boolean generateForeMidHindPercentage(FeatureData featureData, int width, int height) {
        FileOutputStream fos = null;
        try {
            List<String> leftPressureList = new ArrayList<>();
            leftPressureList.add(featureData.getPressureMeanLeft1());
            leftPressureList.add(featureData.getPressureMeanLeft2());
            leftPressureList.add(featureData.getPressureMeanLeft3());
            leftPressureList.add(featureData.getPressureMeanLeft4());
            leftPressureList.add(featureData.getPressureMeanLeft5());
            leftPressureList.add(featureData.getPressureMeanLeft6());
            leftPressureList.add(featureData.getPressureMeanLeft7());
            leftPressureList.add(featureData.getPressureMeanLeft8());
            leftPressureList.add(featureData.getPressureMeanLeft9());

            List<String> rightPressureList = new ArrayList<>();
            rightPressureList.add(featureData.getPressureMeanRigh1());
            rightPressureList.add(featureData.getPressureMeanRight2());
            rightPressureList.add(featureData.getPressureMeanRight3());
            rightPressureList.add(featureData.getPressureMeanRight4());
            rightPressureList.add(featureData.getPressureMeanRight5());
            rightPressureList.add(featureData.getPressureMeanRight6());
            rightPressureList.add(featureData.getPressureMeanRight7());
            rightPressureList.add(featureData.getPressureMeanRight8());
            rightPressureList.add(featureData.getPressureMeanRight9());


            double forePressureValue = Double.parseDouble(leftPressureList.get(1)) + Double.parseDouble(leftPressureList.get(7)) +Double.parseDouble(leftPressureList.get(8)) +
                    Double.parseDouble(rightPressureList.get(1)) + Double.parseDouble(rightPressureList.get(7)) + Double.parseDouble(rightPressureList.get(8));
            double midPressureValue = Double.parseDouble(leftPressureList.get(2)) + Double.parseDouble(leftPressureList.get(6)) +
                    Double.parseDouble(rightPressureList.get(2)) + Double.parseDouble(rightPressureList.get(6)) ;
            double hindPressureValue = Double.parseDouble(leftPressureList.get(3)) + Double.parseDouble(leftPressureList.get(4)) +Double.parseDouble(leftPressureList.get(5)) +
                    Double.parseDouble(rightPressureList.get(3)) + Double.parseDouble(rightPressureList.get(4)) + Double.parseDouble(rightPressureList.get(5));

            double percentage_fore = NumberUtil.div(forePressureValue, forePressureValue + midPressureValue + hindPressureValue, 3);
            double percentage_mid = NumberUtil.div(midPressureValue, forePressureValue + midPressureValue + hindPressureValue, 3);
            double percentage_hind = NumberUtil.div(hindPressureValue, forePressureValue + midPressureValue + hindPressureValue, 3);

            double real_percentage_fore = NumberUtil.mul(percentage_fore, 100);
            double real_percentage_mid = NumberUtil.mul(percentage_mid, 100);
            double real_percentage_hind = NumberUtil.mul(percentage_hind, 100);

            pictureData.put("offset_fore", percentage_fore);
            pictureData.put("offset_mid", percentage_mid);
            pictureData.put("offset_hind", percentage_hind);

            DefaultPieDataset dateSet = new DefaultPieDataset();
            dateSet.setValue("前足", real_percentage_fore);
            dateSet.setValue("中足", real_percentage_mid);
            dateSet.setValue("后足", real_percentage_hind);

            JFreeChart chart = ChartFactory.createRingChart(null,  //标题
                    dateSet,
                    false,
                    false,
                    false);

            chart.setBackgroundPaint(new GradientPaint(0, 0, new Color(255, 255, 255),
                    428,428,new Color(255, 255, 255)));
            chart.setBackgroundImageAlpha(0.8f);
            chart.setTextAntiAlias(false);

            RingPlot ringPlot =(RingPlot)chart.getPlot();

            ringPlot.setLabelFont(new Font("微软雅黑", Font.PLAIN, 20));
            ringPlot.setLabelGap(0.02D);
            ringPlot.setLabelBackgroundPaint(Color.white);
            ringPlot.setLabelOutlinePaint(Color.white);
            ringPlot.setMaximumLabelWidth(0.1D);
            //下面设置的是:饼图里面的百分比去除标签边框,只显示百分比的数据 (4个都要设置,缺一不可)
            ringPlot.setLabelOutlinePaint(null);// (1)自定义标签产生器,设置绘图面板外边的填充颜色
            ringPlot.setLabelShadowPaint(null);//自定义标签产生器, 设置绘图面板阴影的填充颜色
            ringPlot.setLabelOutlineStroke(null);//(2) 自定义标签产生器,设置绘图面板外边的填充颜色
            ringPlot.setLabelBackgroundPaint(null);//自定义标签产生器,背景色
            //上面设置的是:饼图里面的百分比去除标签边框,只显示百分比的数据

            ringPlot.setCircular(true);
            ringPlot.setOutlinePaint(Color.white);
            ringPlot.setOutlineStroke(new BasicStroke(10));
            ringPlot.setSectionOutlinesVisible(false);
            ringPlot.setBackgroundPaint(Color.white);
            ringPlot.setSeparatorsVisible(false);

            //设置开始角度
            ringPlot.setStartAngle(90D);
            //设置为顺时针方向
            ringPlot.setDirection(Rotation.CLOCKWISE);
            //设置透明度， 0.5F为半透明，1为不透明，0为全透明
            ringPlot.setForegroundAlpha(0.9f);
            ringPlot.setShadowPaint(null);

            //设置每部分颜色
            ringPlot.setSectionPaint("前足", Color.decode("#B3E67E"));
            ringPlot.setSectionPaint("中足", Color.decode("#7ECDE6"));
            ringPlot.setSectionPaint("后足", Color.decode("#7EE6E2"));
            // 设置深度，即带颜色圆环的宽度
            ringPlot.setSectionDepth(0.35d);

            DecimalFormat df = new DecimalFormat("0.00%");
            NumberFormat nf = NumberFormat.getNumberInstance();
            StandardPieSectionLabelGenerator sp = new StandardPieSectionLabelGenerator("{2}", nf, df);
            ringPlot.setLabelGenerator(sp);

//            DefaultCategoryDataset dateSet = new DefaultCategoryDataset();
//            dateSet.setValue(real_percentage_fore, "前足", "");
//            dateSet.setValue(real_percentage_mid, "中足", "");
//            dateSet.setValue(real_percentage_hind, "后足", "");
//
//            JFreeChart chart = ChartFactory.createBarChart(null, //标题
//                    null, //目录轴的显示标签
//                    "全足区域比(%)", //数值的显示标签
//                    dateSet, //数据
//                    PlotOrientation.VERTICAL, //图标方向:水平/垂直
//                    true,  //是否显示图例
//                    false, //是否生成工具
//                    false); //是否生成URL链接
//
//            LegendTitle legend = chart.getLegend(); // 图例
//            legend.setItemFont(new Font("黑体", Font.BOLD, 20));
//
//            CategoryPlot categoryPlot = chart.getCategoryPlot();//图部分
//            categoryPlot.setBackgroundPaint(ChartColor.WHITE); // 设置图的背景颜色
//            chart.getLegend().setItemFont( new Font("黑体",Font.BOLD,20));//图标字体
//            CategoryAxis domainAxis = categoryPlot.getDomainAxis();//X轴
//
//            domainAxis.setCategoryLabelPositions(CategoryLabelPositions.STANDARD);//X轴下标  90°显示
//            domainAxis.setMaximumCategoryLabelLines(10);//自动换行    最多显示多少行
//            domainAxis.setLabelFont(new Font("黑体",Font.BOLD,20));//下标
//            domainAxis.setTickLabelFont(new Font("宋体",Font.BOLD,20));//X轴标题
//            domainAxis.setAxisLineVisible(true);
//
//            ValueAxis rangeAxis = categoryPlot.getRangeAxis();//Y轴
//            rangeAxis.setLabelFont(new Font("黑体",Font.BOLD,20));//下标
//            rangeAxis.setTickLabelFont(new Font("宋体",Font.BOLD,20));//Y轴标题
//            rangeAxis.setLowerMargin(0); // 纵轴与底部的距离
//            rangeAxis.setAxisLineVisible(true);
//
//            NumberAxis numberAxis = (NumberAxis) categoryPlot.getRangeAxis();
//            numberAxis.setAutoTickUnitSelection(false); // 是否自动设置Y轴刻度
//            numberAxis.setTickUnit(new NumberTickUnit(10));  //刻度大小
//            numberAxis.setAutoRangeStickyZero(true);//和下面一行搭配使用   设置Y轴都是正数
//            numberAxis.setRangeType(RangeType.POSITIVE);
//            numberAxis.setNumberFormatOverride(new DecimalFormat("#"));//设置Y轴上的数值精度
//            numberAxis.setRangeWithMargins(0, 100);    //Y轴范围
//
//            BarRenderer renderer = (BarRenderer) categoryPlot.getRenderer();//图形修改
//            renderer.setItemMargin(0.1);//设置柱子之间的距离
//            renderer.setPositiveItemLabelPositionFallback(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER));
//            renderer.setDrawBarOutline(false);
//            renderer.setMaximumBarWidth(0.2); //设置柱子宽度
//            renderer.setMinimumBarLength(0); //设置柱子高度
//            renderer.setSeriesPaint(0, Color.decode("#B3E67E")); // 设置柱子的颜色
//            renderer.setSeriesPaint(1, Color.decode("#7ECDE6"));  // 设置柱子的颜色
//            renderer.setSeriesPaint(2, Color.decode("#7EE6E2"));  // 设置柱子的颜色
//
//            renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}%" , NumberFormat.getInstance())); // 设置数值显示,格式是百分比
//            renderer.setBaseItemLabelsVisible(true);
//            renderer.setBaseItemLabelFont(new Font("黑体",Font.BOLD,20));
//            renderer.setBaseItemLabelPaint(ChartColor.BLACK);

            File file = new File(this.tempImageDir);
            if (!file.exists()) file.mkdir();
            String foreFootPath = this.tempImageDir + File.separator + "offset.jpg";
            fos = new FileOutputStream(foreFootPath);
            ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        } finally {
            try {
                if (fos!=null) fos.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    /**
     * 生成体重百分比左脚-饼图
     * @param featureData
     * @param width
     * @param height
     * @return
     */
    private boolean generateWeightPercentageLeft(FeatureData featureData, int width, int height) {
        FileOutputStream fos = null;
        System.out.println(width);
        try {
            List<String> leftPressureList = new ArrayList<>();
            leftPressureList.add(featureData.getPressureMeanLeft1());
            leftPressureList.add(featureData.getPressureMeanLeft2());
            leftPressureList.add(featureData.getPressureMeanLeft3());
            leftPressureList.add(featureData.getPressureMeanLeft4());
            leftPressureList.add(featureData.getPressureMeanLeft5());
            leftPressureList.add(featureData.getPressureMeanLeft6());
            leftPressureList.add(featureData.getPressureMeanLeft7());
            leftPressureList.add(featureData.getPressureMeanLeft8());
            leftPressureList.add(featureData.getPressureMeanLeft9());

            double leftPressureValue = Double.parseDouble(leftPressureList.get(0)) + Double.parseDouble(leftPressureList.get(1)) + Double.parseDouble(leftPressureList.get(2)) + Double.parseDouble(leftPressureList.get(3)) + Double.parseDouble(leftPressureList.get(4)) +
                    Double.parseDouble(leftPressureList.get(5)) + Double.parseDouble(leftPressureList.get(6)) +Double.parseDouble(leftPressureList.get(7)) + Double.parseDouble(leftPressureList.get(8));

            double percentage_one = NumberUtil.div(Double.parseDouble(leftPressureList.get(0)), leftPressureValue , 10);
            double percentage_two = NumberUtil.div(Double.parseDouble(leftPressureList.get(1)), leftPressureValue , 10);
            double percentage_three = NumberUtil.div(Double.parseDouble(leftPressureList.get(2)), leftPressureValue , 10);
            double percentage_four = NumberUtil.div(Double.parseDouble(leftPressureList.get(3)), leftPressureValue , 10);
            double percentage_five = NumberUtil.div(Double.parseDouble(leftPressureList.get(4)), leftPressureValue, 10);
            double percentage_six = NumberUtil.div(Double.parseDouble(leftPressureList.get(5)), leftPressureValue , 10);
            double percentage_seven = NumberUtil.div(Double.parseDouble(leftPressureList.get(6)), leftPressureValue, 10);
            double percentage_eight = NumberUtil.div(Double.parseDouble(leftPressureList.get(7)), leftPressureValue , 10);
            double percentage_nine = NumberUtil.div(Double.parseDouble(leftPressureList.get(8)), leftPressureValue , 10);


            double real_percentage_one = NumberUtil.mul(percentage_one, 100);
            double real_percentage_two = NumberUtil.mul(percentage_two, 100);
            double real_percentage_three = NumberUtil.mul(percentage_three, 100);
            double real_percentage_four = NumberUtil.mul(percentage_four, 100);
            double real_percentage_five = NumberUtil.mul(percentage_five, 100);
            double real_percentage_six = NumberUtil.mul(percentage_six, 100);
            double real_percentage_seven = NumberUtil.mul(percentage_seven, 100);
            double real_percentage_eight = NumberUtil.mul(percentage_eight, 100);
            double real_percentage_nine = NumberUtil.mul(percentage_nine, 100);


            pictureData.put("区域1", percentage_one);
            pictureData.put("区域2", percentage_two);
            pictureData.put("区域3", percentage_three);
            pictureData.put("区域4", percentage_four);
            pictureData.put("区域5", percentage_five);
            pictureData.put("区域6", percentage_six);
            pictureData.put("区域7", percentage_seven);
            pictureData.put("区域8", percentage_eight);
            pictureData.put("区域9", percentage_nine);

            DefaultPieDataset dataset = new DefaultPieDataset();

            dataset.setValue("区域1", real_percentage_one);
            dataset.setValue("区域2", real_percentage_two);
            dataset.setValue("区域3", real_percentage_three);
            dataset.setValue("区域4", real_percentage_four);
            dataset.setValue("区域5", real_percentage_five);
            dataset.setValue("区域6", real_percentage_six);
            dataset.setValue("区域7", real_percentage_seven);
            dataset.setValue("区域8", real_percentage_eight);
            dataset.setValue("区域9", real_percentage_nine);

            JFreeChart chart = ChartFactory.createPieChart("左脚体重百分比", dataset,
                    false,   //是否显示图例
                    false,  //是否生成工具
                    false);   //是否生成url链接

            //解决中文乱码

            TextTitle textTitle =chart.getTitle();
            textTitle.setFont(new Font("微软雅黑", Font.BOLD, 30));
            textTitle.setPaint(Color.decode("#6097E7"));

            chart.setBackgroundPaint(new GradientPaint(0, 0, new Color(255,255,255),
                    428, 428, new Color(255,255,255)));
            chart.setBackgroundImageAlpha(0.8f);


            PiePlot pie = (PiePlot) chart.getPlot();
            pie.setLabelFont(new Font("微软雅黑", Font.PLAIN, 12));
            pie.setLabelBackgroundPaint(Color.white);
            pie.setLabelShadowPaint(null);
            //设置dataset为null时显示的提示信息
//            pie.setNoDataMessage("No data available");
            //设置PieChart是否显示为圆形
            pie.setCircular(true);

            pie.setBackgroundPaint(Color.white);
            //设置每部分颜色
            pie.setSectionPaint("区域1", Color.decode("#5C9795"));
            pie.setSectionPaint("区域2", Color.decode("#9DD187"));
            pie.setSectionPaint("区域3", Color.decode("#F1A39F"));
            pie.setSectionPaint("区域4", Color.decode("#E59540"));
            pie.setSectionPaint("区域5", Color.decode("#ABCBE7"));
            pie.setSectionPaint("区域6", Color.decode("#EDD174"));
            pie.setSectionPaint("区域7", Color.decode("#A97CA1"));
            pie.setSectionPaint("区域8", Color.decode("#D3605C"));
            pie.setSectionPaint("区域9", Color.decode("#7985C9"));

            DecimalFormat df = new DecimalFormat("0.00%");//获得一个DecimalFormat对象，主要是设置小数问题
            NumberFormat nf = NumberFormat.getNumberInstance();//获得一个NumberFormat对象
            StandardPieSectionLabelGenerator sp = new StandardPieSectionLabelGenerator("{0}({2})", nf, df);//获得StandardPieSectionLabelGenerator对象
            pie.setLabelGenerator(sp);
            // 片区外廓不可见
            // pie.setSectionOutlinesVisible(false);
            //处理零值，负值
            pie.setIgnoreZeroValues(true);

            File file = new File(this.tempImageDir);
            if (!file.exists()) file.mkdir();
            String imagePath = this.tempImageDir + File.separator + "weightPercentage_left.jpg";

            fos = new FileOutputStream(imagePath);
            ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            return true;

        } catch (Exception e) {
            e.printStackTrace();
            return false;
        } finally {
            try {
                if (fos != null) fos.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    /**
     * 生成体重百分比右脚-饼图
     * @param featureData
     * @param width
     * @param height
     * @return
     */
    private boolean generateWeightPercentageRight(FeatureData featureData, int width, int height) {
        FileOutputStream fos = null;
        try {
            List<String> rightPressureList = new ArrayList<>();
            rightPressureList.add(featureData.getPressureMeanRigh1());
            rightPressureList.add(featureData.getPressureMeanRight2());
            rightPressureList.add(featureData.getPressureMeanRight3());
            rightPressureList.add(featureData.getPressureMeanRight4());
            rightPressureList.add(featureData.getPressureMeanRight5());
            rightPressureList.add(featureData.getPressureMeanRight6());
            rightPressureList.add(featureData.getPressureMeanRight7());
            rightPressureList.add(featureData.getPressureMeanRight8());
            rightPressureList.add(featureData.getPressureMeanRight9());

            double rightPressureValue = Double.parseDouble(rightPressureList.get(0)) + Double.parseDouble(rightPressureList.get(1)) + Double.parseDouble(rightPressureList.get(2)) + Double.parseDouble(rightPressureList.get(3)) + Double.parseDouble(rightPressureList.get(4)) +
                    Double.parseDouble(rightPressureList.get(5)) + Double.parseDouble(rightPressureList.get(6)) +Double.parseDouble(rightPressureList.get(7)) + Double.parseDouble(rightPressureList.get(8));

            double percentage_one = NumberUtil.div(Double.parseDouble(rightPressureList.get(0)), rightPressureValue , 10);
            double percentage_two = NumberUtil.div(Double.parseDouble(rightPressureList.get(1)), rightPressureValue , 10);
            double percentage_three = NumberUtil.div(Double.parseDouble(rightPressureList.get(2)), rightPressureValue , 10);
            double percentage_four = NumberUtil.div(Double.parseDouble(rightPressureList.get(3)), rightPressureValue , 10);
            double percentage_five = NumberUtil.div(Double.parseDouble(rightPressureList.get(4)), rightPressureValue, 10);
            double percentage_six = NumberUtil.div(Double.parseDouble(rightPressureList.get(5)), rightPressureValue , 10);
            double percentage_seven = NumberUtil.div(Double.parseDouble(rightPressureList.get(6)), rightPressureValue, 10);
            double percentage_eight = NumberUtil.div(Double.parseDouble(rightPressureList.get(7)), rightPressureValue , 10);
            double percentage_nine = NumberUtil.div(Double.parseDouble(rightPressureList.get(8)), rightPressureValue , 10);


            double real_percentage_one = NumberUtil.mul(percentage_one, 100);
            double real_percentage_two = NumberUtil.mul(percentage_two, 100);
            double real_percentage_three = NumberUtil.mul(percentage_three, 100);
            double real_percentage_four = NumberUtil.mul(percentage_four, 100);
            double real_percentage_five = NumberUtil.mul(percentage_five, 100);
            double real_percentage_six = NumberUtil.mul(percentage_six, 100);
            double real_percentage_seven = NumberUtil.mul(percentage_seven, 100);
            double real_percentage_eight = NumberUtil.mul(percentage_eight, 100);
            double real_percentage_nine = NumberUtil.mul(percentage_nine, 100);


            pictureData.put("区域1", percentage_one);
            pictureData.put("区域2", percentage_two);
            pictureData.put("区域3", percentage_three);
            pictureData.put("区域4", percentage_four);
            pictureData.put("区域5", percentage_five);
            pictureData.put("区域6", percentage_six);
            pictureData.put("区域7", percentage_seven);
            pictureData.put("区域8", percentage_eight);
            pictureData.put("区域9", percentage_nine);

            DefaultPieDataset dataset = new DefaultPieDataset();
            dataset.setValue("区域1", real_percentage_one);
            dataset.setValue("区域2", real_percentage_two);
            dataset.setValue("区域3", real_percentage_three);
            dataset.setValue("区域4", real_percentage_four);
            dataset.setValue("区域5", real_percentage_five);
            dataset.setValue("区域6", real_percentage_six);
            dataset.setValue("区域7", real_percentage_seven);
            dataset.setValue("区域8", real_percentage_eight);
            dataset.setValue("区域9", real_percentage_nine);



            JFreeChart chart = ChartFactory.createPieChart("右脚体重百分比", dataset,
                    false,   //是否显示图例
                    false,  //是否生成工具
                    false);   //是否生成url链接


            chart.setBackgroundPaint(new GradientPaint(0, 0, new Color(255,255,255),
                    428, 428, new Color(255,255,255)));
            chart.setBackgroundImageAlpha(0.8f);

            //解决中文乱码

            TextTitle textTitle =chart.getTitle();
            textTitle.setFont(new Font("微软雅黑", Font.BOLD, 30));
            textTitle.setPaint(Color.decode("#6097E7"));

            PiePlot pie = (PiePlot) chart.getPlot();
            pie.setLabelFont(new Font("微软雅黑", Font.PLAIN, 12));
            pie.setLabelBackgroundPaint(Color.white);
            pie.setLabelShadowPaint(null);
            //设置dataset为null时显示的提示信息
//            pie.setNoDataMessage("No data available");
            //设置PieChart是否显示为圆形
            pie.setCircular(true);

            pie.setBackgroundPaint(Color.white);
            //设置每部分颜色
            pie.setSectionPaint("区域1", Color.decode("#5C9795"));
            pie.setSectionPaint("区域2", Color.decode("#9DD187"));
            pie.setSectionPaint("区域3", Color.decode("#F1A39F"));
            pie.setSectionPaint("区域4", Color.decode("#E59540"));
            pie.setSectionPaint("区域5", Color.decode("#ABCBE7"));
            pie.setSectionPaint("区域6", Color.decode("#EDD174"));
            pie.setSectionPaint("区域7", Color.decode("#A97CA1"));
            pie.setSectionPaint("区域8", Color.decode("#D3605C"));
            pie.setSectionPaint("区域9", Color.decode("#7985C9"));

            DecimalFormat df = new DecimalFormat("0.00%");//获得一个DecimalFormat对象，主要是设置小数问题
            NumberFormat nf = NumberFormat.getNumberInstance();//获得一个NumberFormat对象
            StandardPieSectionLabelGenerator sp = new StandardPieSectionLabelGenerator("{0}({2})", nf, df);//获得StandardPieSectionLabelGenerator对象
            pie.setLabelGenerator(sp);
            // 片区外廓不可见
            // pie.setSectionOutlinesVisible(false);
            //处理零值，负值
            pie.setIgnoreZeroValues(true);


            File file = new File(this.tempImageDir);
            if (!file.exists()) file.mkdir();
            String imagePath = this.tempImageDir + File.separator + "weightPercentage_right.jpg";

            fos = new FileOutputStream(imagePath);
            ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            return true;

        } catch (Exception e) {
            e.printStackTrace();
            return false;
        } finally {
            try {
                if (fos != null) fos.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    /**
     * 生成左足的前中后足区域比图   "leftOffset.jpg"
     * @param featureData
     * @param width
     * @param height
     * @return
     */
    private boolean generateleftOffset(FeatureData featureData, int width, int height) {
        FileOutputStream fos = null;
        try {
            List<String> leftPressureList = new ArrayList<>();
            leftPressureList.add(featureData.getPressureMeanLeft1());
            leftPressureList.add(featureData.getPressureMeanLeft2());
            leftPressureList.add(featureData.getPressureMeanLeft3());
            leftPressureList.add(featureData.getPressureMeanLeft4());
            leftPressureList.add(featureData.getPressureMeanLeft5());
            leftPressureList.add(featureData.getPressureMeanLeft6());
            leftPressureList.add(featureData.getPressureMeanLeft7());
            leftPressureList.add(featureData.getPressureMeanLeft8());
            leftPressureList.add(featureData.getPressureMeanLeft9());

            double forePressureValue_left = Double.parseDouble(leftPressureList.get(1)) + Double.parseDouble(leftPressureList.get(7)) + Double.parseDouble(leftPressureList.get(8));
            double midPressureValue_left = Double.parseDouble(leftPressureList.get(2)) + Double.parseDouble(leftPressureList.get(6));
            double hindPressureValue_left = Double.parseDouble(leftPressureList.get(3)) + Double.parseDouble(leftPressureList.get(4)) + Double.parseDouble(leftPressureList.get(5));
            double percentage_fore = NumberUtil.div(forePressureValue_left, forePressureValue_left + midPressureValue_left + hindPressureValue_left, 3);
            double percentage_mid = NumberUtil.div(midPressureValue_left, forePressureValue_left + midPressureValue_left + hindPressureValue_left, 3);
            double percentage_hind = NumberUtil.div(hindPressureValue_left, forePressureValue_left + midPressureValue_left + hindPressureValue_left, 3);
            double real_percentage_fore = NumberUtil.mul(percentage_fore, 100);
            double real_percentage_mid = NumberUtil.mul(percentage_mid, 100);
            double real_percentage_hind = NumberUtil.mul(percentage_hind, 100);

            pictureData.put("offset_fore_left", percentage_fore);
            pictureData.put("offset_mid_left", percentage_mid);
            pictureData.put("offset_hind_left", percentage_hind);

            DefaultPieDataset dateSet = new DefaultPieDataset();
            dateSet.setValue("前足", real_percentage_fore);
            dateSet.setValue("中足", real_percentage_mid);
            dateSet.setValue("后足", real_percentage_hind);

            JFreeChart chart = ChartFactory.createRingChart(null,  //标题
                          dateSet,
                    false,
                    false,
                    false);

            chart.setBackgroundPaint(new GradientPaint(0, 0, new Color(255, 255, 255),
                    428,428,new Color(255, 255, 255)));
            chart.setBackgroundImageAlpha(0.8f);
            chart.setTextAntiAlias(false);

            RingPlot ringPlot =(RingPlot)chart.getPlot();

            ringPlot.setLabelFont(new Font("微软雅黑", Font.PLAIN, 20));
            ringPlot.setLabelGap(0.02D);
            ringPlot.setLabelBackgroundPaint(Color.white);
            ringPlot.setLabelOutlinePaint(Color.white);
            ringPlot.setLabelLinksVisible(true);
            ringPlot.setLabelLinkPaint(Color.decode("#ABCBE7"));
            ringPlot.setMaximumLabelWidth(0.1D);
            //下面设置的是:饼图里面的百分比去除标签边框,只显示百分比的数据 (4个都要设置,缺一不可)
            ringPlot.setLabelOutlinePaint(null);// (1)自定义标签产生器,设置绘图面板外边的填充颜色
            ringPlot.setLabelShadowPaint(null);//自定义标签产生器, 设置绘图面板阴影的填充颜色
            ringPlot.setLabelOutlineStroke(null);//(2) 自定义标签产生器,设置绘图面板外边的填充颜色
            ringPlot.setLabelBackgroundPaint(null);//自定义标签产生器,背景色
            //上面设置的是:饼图里面的百分比去除标签边框,只显示百分比的数据


            ringPlot.setCircular(true);
            ringPlot.setOutlinePaint(Color.white);
            ringPlot.setOutlineStroke(new BasicStroke(10));
            ringPlot.setSectionOutlinesVisible(false);
            ringPlot.setBackgroundPaint(Color.white);
            ringPlot.setSeparatorsVisible(false);

            //设置开始角度
            ringPlot.setStartAngle(90D);
            //设置为顺时针方向
            ringPlot.setDirection(Rotation.CLOCKWISE);
            //设置透明度， 0.5F为半透明，1为不透明，0为全透明
            ringPlot.setForegroundAlpha(0.9f);
            ringPlot.setShadowPaint(null);

            //设置每部分颜色
            ringPlot.setSectionPaint("前足", Color.decode("#B3E67E"));
            ringPlot.setSectionPaint("中足", Color.decode("#7ECDE6"));
            ringPlot.setSectionPaint("后足", Color.decode("#7EE6E2"));
            // 设置深度，即带颜色圆环的宽度
            ringPlot.setSectionDepth(0.35d);

            DecimalFormat df = new DecimalFormat("0.00%");
            NumberFormat nf = NumberFormat.getNumberInstance();
            StandardPieSectionLabelGenerator sp = new StandardPieSectionLabelGenerator("{2}", nf, df);
            ringPlot.setLabelGenerator(sp);

//            JFreeChart chart = ChartFactory.createBarChart(null, //标题
//                    null, //目录轴的显示标签
//                    "左足区域比(%)", //数值的显示标签
//                    dateSet, //数据
//                    PlotOrientation.VERTICAL, //图标方向:水平/垂直
//                    true,  //是否显示图例
//                    false, //是否生成工具
//                    false); //是否生成URL链接
//
//            LegendTitle legend = chart.getLegend(); // 图例
//            legend.setItemFont(new Font("黑体", Font.BOLD, 20));
//
//            CategoryPlot categoryPlot = chart.getCategoryPlot();//图部分
//            categoryPlot.setBackgroundPaint(ChartColor.WHITE); // 设置图的背景颜色
//            chart.getLegend().setItemFont( new Font("黑体",Font.BOLD,20));//图标字体
//            CategoryAxis domainAxis = categoryPlot.getDomainAxis();//X轴
//
//            domainAxis.setCategoryLabelPositions(CategoryLabelPositions.STANDARD);//X轴下标  90°显示
//            domainAxis.setMaximumCategoryLabelLines(10);//自动换行    最多显示多少行
//            domainAxis.setLabelFont(new Font("黑体",Font.BOLD,20));//下标
//            domainAxis.setTickLabelFont(new Font("宋体",Font.BOLD,20));//X轴标题
//            domainAxis.setAxisLineVisible(true);
//
//            ValueAxis rangeAxis = categoryPlot.getRangeAxis();//Y轴
//            rangeAxis.setLabelFont(new Font("黑体",Font.BOLD,20));//下标
//            rangeAxis.setTickLabelFont(new Font("宋体",Font.BOLD,20));//Y轴标题
//            rangeAxis.setLowerMargin(0); // 纵轴与底部的距离
//            rangeAxis.setAxisLineVisible(true);
//
//            NumberAxis numberAxis = (NumberAxis) categoryPlot.getRangeAxis();
//            numberAxis.setAutoTickUnitSelection(false); // 是否自动设置Y轴刻度
//            numberAxis.setTickUnit(new NumberTickUnit(10));  //刻度大小
//            numberAxis.setAutoRangeStickyZero(true);//和下面一行搭配使用   设置Y轴都是正数
//            numberAxis.setRangeType(RangeType.POSITIVE);
//            numberAxis.setNumberFormatOverride(new DecimalFormat("#"));//设置Y轴上的数值精度
//            numberAxis.setRangeWithMargins(0, 100);    //Y轴范围
//
//            BarRenderer renderer = (BarRenderer) categoryPlot.getRenderer();//图形修改
//            renderer.setItemMargin(0.1);//设置柱子之间的距离
//            renderer.setPositiveItemLabelPositionFallback(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER));
//            renderer.setDrawBarOutline(false);
//            renderer.setMaximumBarWidth(0.2); //设置柱子宽度
//            renderer.setMinimumBarLength(0); //设置柱子高度
//            renderer.setSeriesPaint(0, Color.decode("#B3E67E")); // 设置柱子的颜色
//            renderer.setSeriesPaint(1, Color.decode("#7ECDE6"));  // 设置柱子的颜色
//            renderer.setSeriesPaint(2, Color.decode("#7EE6E2"));  // 设置柱子的颜色
//
//            renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}%" , NumberFormat.getInstance())); // 设置数值显示,格式是百分比
//            renderer.setBaseItemLabelsVisible(true);
//            renderer.setBaseItemLabelFont(new Font("黑体",Font.BOLD,20));
//            renderer.setBaseItemLabelPaint(ChartColor.BLACK);

            File file = new File(this.tempImageDir);
            if (!file.exists()) file.mkdir();
            String foreFootPath = this.tempImageDir + File.separator + "leftOffset.jpg";
            fos = new FileOutputStream(foreFootPath);
            ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        } finally {
            try {
                if (fos!=null) fos.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    /**
     * 生成右足的前中后足区域比图   "rightOffset.jpg"
     * @param featureData
     * @param width
     * @param height
     * @return
     */
    private boolean generaterightOffset(FeatureData featureData, int width, int height) {
        FileOutputStream fos = null;
        try {
            List<String> rightPressureList = new ArrayList<>();
            rightPressureList.add(featureData.getPressureMeanRigh1());
            rightPressureList.add(featureData.getPressureMeanRight2());
            rightPressureList.add(featureData.getPressureMeanRight3());
            rightPressureList.add(featureData.getPressureMeanRight4());
            rightPressureList.add(featureData.getPressureMeanRight5());
            rightPressureList.add(featureData.getPressureMeanRight6());
            rightPressureList.add(featureData.getPressureMeanRight7());
            rightPressureList.add(featureData.getPressureMeanRight8());
            rightPressureList.add(featureData.getPressureMeanRight9());


            double forePressureValue_right = Double.parseDouble(rightPressureList.get(1)) + Double.parseDouble(rightPressureList.get(7)) + Double.parseDouble(rightPressureList.get(8));
            double midPressureValue_right = Double.parseDouble(rightPressureList.get(2)) + Double.parseDouble(rightPressureList.get(6));
            double hindPressureValue_right = Double.parseDouble(rightPressureList.get(3)) + Double.parseDouble(rightPressureList.get(4)) + Double.parseDouble(rightPressureList.get(5));
            double percentage_fore = NumberUtil.div(forePressureValue_right, forePressureValue_right + midPressureValue_right + hindPressureValue_right, 3);
            double percentage_mid = NumberUtil.div(midPressureValue_right, forePressureValue_right + midPressureValue_right + hindPressureValue_right, 3);
            double percentage_hind = NumberUtil.div(hindPressureValue_right, forePressureValue_right + midPressureValue_right + hindPressureValue_right, 3);
            double real_percentage_fore = NumberUtil.mul(percentage_fore, 100);
            double real_percentage_mid = NumberUtil.mul(percentage_mid, 100);
            double real_percentage_hind = NumberUtil.mul(percentage_hind, 100);

            pictureData.put("offset_fore_right", percentage_fore);
            pictureData.put("offset_mid_right", percentage_mid);
            pictureData.put("offset_hind_right", percentage_hind);

            DefaultPieDataset dataset = new DefaultPieDataset();
            dataset.setValue("前足", real_percentage_fore);
            dataset.setValue("中足", real_percentage_mid);
            dataset.setValue("后足", real_percentage_hind);

            JFreeChart chart = ChartFactory.createRingChart(null,  //标题
                    dataset,
                    false,
                    false,
                    false);

            chart.setBackgroundPaint(new GradientPaint(0, 0, new Color(255, 255, 255),
                    428,428,new Color(255, 255, 255)));
            chart.setBackgroundImageAlpha(0.8f);
            chart.setTextAntiAlias(false);

            RingPlot ringPlot =(RingPlot)chart.getPlot();

            ringPlot.setLabelFont(new Font("微软雅黑", Font.PLAIN, 20));
            ringPlot.setLabelGap(0.02D);
            ringPlot.setLabelBackgroundPaint(Color.white);
            ringPlot.setLabelOutlinePaint(Color.white);
            ringPlot.setSeparatorsVisible(false);
            ringPlot.setLabelLinkPaint(Color.decode("#ABCBE7"));
            ringPlot.setMaximumLabelWidth(0.1D);
            //下面设置的是:饼图里面的百分比去除标签边框,只显示百分比的数据 (4个都要设置,缺一不可)
            ringPlot.setLabelOutlinePaint(null);// (1)自定义标签产生器,设置绘图面板外边的填充颜色
            ringPlot.setLabelShadowPaint(null);//自定义标签产生器, 设置绘图面板阴影的填充颜色
            ringPlot.setLabelOutlineStroke(null);//(2) 自定义标签产生器,设置绘图面板外边的填充颜色
            ringPlot.setLabelBackgroundPaint(null);//自定义标签产生器,背景色
            //上面设置的是:饼图里面的百分比去除标签边框,只显示百分比的数据

            ringPlot.setCircular(true);
            ringPlot.setOutlinePaint(Color.white);
            ringPlot.setOutlineStroke(new BasicStroke(10));
            ringPlot.setSectionOutlinesVisible(false);
            ringPlot.setBackgroundPaint(Color.white);

            //设置开始角度
            ringPlot.setStartAngle(90D);
            //设置为顺时针方向
            ringPlot.setDirection(Rotation.CLOCKWISE);
            //设置透明度， 0.5F为半透明，1为不透明，0为全透明
            ringPlot.setForegroundAlpha(0.9f);
            ringPlot.setShadowPaint(null);

            //设置每部分颜色
            ringPlot.setSectionPaint("前足", Color.decode("#B3E67E"));
            ringPlot.setSectionPaint("中足", Color.decode("#7ECDE6"));
            ringPlot.setSectionPaint("后足", Color.decode("#7EE6E2"));
            // 设置深度，即带颜色圆环的宽度
            ringPlot.setSectionDepth(0.35d);

            DecimalFormat df = new DecimalFormat("0.00%");
            NumberFormat nf = NumberFormat.getNumberInstance();
            StandardPieSectionLabelGenerator sp = new StandardPieSectionLabelGenerator("{2}", nf, df);
            ringPlot.setLabelGenerator(sp);

//            JFreeChart chart = ChartFactory.createBarChart(null, //标题
//                    null, //目录轴的显示标签
//                    "右足区域比(%)", //数值的显示标签
//                    dateSet, //数据
//                    PlotOrientation.VERTICAL, //图标方向:水平/垂直
//                    true,  //是否显示图例
//                    false, //是否生成工具
//                    false); //是否生成URL链接
//
//            LegendTitle legend = chart.getLegend(); // 图例
//            legend.setItemFont(new Font("黑体", Font.BOLD, 20));
//
//            CategoryPlot categoryPlot = chart.getCategoryPlot();//图部分
//            categoryPlot.setBackgroundPaint(ChartColor.WHITE); // 设置图的背景颜色
//            chart.getLegend().setItemFont( new Font("黑体",Font.BOLD,20));//图标字体
//            CategoryAxis domainAxis = categoryPlot.getDomainAxis();//X轴
//
//            domainAxis.setCategoryLabelPositions(CategoryLabelPositions.STANDARD);//X轴下标  90°显示
//            domainAxis.setMaximumCategoryLabelLines(10);//自动换行    最多显示多少行
//            domainAxis.setLabelFont(new Font("黑体",Font.BOLD,20));//下标
//            domainAxis.setTickLabelFont(new Font("宋体",Font.BOLD,20));//X轴标题
//            domainAxis.setAxisLineVisible(true);
//
//            ValueAxis rangeAxis = categoryPlot.getRangeAxis();//Y轴
//            rangeAxis.setLabelFont(new Font("黑体",Font.BOLD,20));//下标
//            rangeAxis.setTickLabelFont(new Font("宋体",Font.BOLD,20));//Y轴标题
//            rangeAxis.setLowerMargin(0); // 纵轴与底部的距离
//            rangeAxis.setAxisLineVisible(true);
//
//            NumberAxis numberAxis = (NumberAxis) categoryPlot.getRangeAxis();
//            numberAxis.setAutoTickUnitSelection(false); // 是否自动设置Y轴刻度
//            numberAxis.setTickUnit(new NumberTickUnit(10));  //刻度大小
//            numberAxis.setAutoRangeStickyZero(true);//和下面一行搭配使用   设置Y轴都是正数
//            numberAxis.setRangeType(RangeType.POSITIVE);
//            numberAxis.setNumberFormatOverride(new DecimalFormat("#"));//设置Y轴上的数值精度
//            numberAxis.setRangeWithMargins(0, 100);    //Y轴范围
//
//            BarRenderer renderer = (BarRenderer) categoryPlot.getRenderer();//图形修改
//            renderer.setItemMargin(0.1);//设置柱子之间的距离
//            renderer.setPositiveItemLabelPositionFallback(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER));
//            renderer.setDrawBarOutline(false);
//            renderer.setMaximumBarWidth(0.2); //设置柱子宽度
//            renderer.setMinimumBarLength(0); //设置柱子高度
//            renderer.setSeriesPaint(0, Color.decode("#B3E67E")); // 设置柱子的颜色
//            renderer.setSeriesPaint(1, Color.decode("#7ECDE6"));  // 设置柱子的颜色
//            renderer.setSeriesPaint(2, Color.decode("#7EE6E2"));  // 设置柱子的颜色
//
//            renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}%" , NumberFormat.getInstance())); // 设置数值显示,格式是百分比
//            renderer.setBaseItemLabelsVisible(true);
//            renderer.setBaseItemLabelFont(new Font("黑体",Font.BOLD,20));
//            renderer.setBaseItemLabelPaint(ChartColor.BLACK);

            File file = new File(this.tempImageDir);
            if (!file.exists()) file.mkdir();
            String rightOffsetPath = this.tempImageDir + File.separator + "rightOffset.jpg";
            fos = new FileOutputStream(rightOffsetPath);
            ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        } finally {
            try {
                if (fos!=null) fos.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    /**
     * 生成前足区域比图   "foreFoot.jpg"
     * @param featureData
     * @param width
     * @param height
     * @return
     */
    private boolean generateForeFoot(FeatureData featureData, int width, int height) {
        FileOutputStream fos = null;
        try {
            List<String> leftPressureList = new ArrayList<>();
            leftPressureList.add(featureData.getPressureMeanLeft1());
            leftPressureList.add(featureData.getPressureMeanLeft2());
            leftPressureList.add(featureData.getPressureMeanLeft3());
            leftPressureList.add(featureData.getPressureMeanLeft4());
            leftPressureList.add(featureData.getPressureMeanLeft5());
            leftPressureList.add(featureData.getPressureMeanLeft6());
            leftPressureList.add(featureData.getPressureMeanLeft7());
            leftPressureList.add(featureData.getPressureMeanLeft8());
            leftPressureList.add(featureData.getPressureMeanLeft9());

            List<String> rightPressureList = new ArrayList<>();
            rightPressureList.add(featureData.getPressureMeanRigh1());
            rightPressureList.add(featureData.getPressureMeanRight2());
            rightPressureList.add(featureData.getPressureMeanRight3());
            rightPressureList.add(featureData.getPressureMeanRight4());
            rightPressureList.add(featureData.getPressureMeanRight5());
            rightPressureList.add(featureData.getPressureMeanRight6());
            rightPressureList.add(featureData.getPressureMeanRight7());
            rightPressureList.add(featureData.getPressureMeanRight8());
            rightPressureList.add(featureData.getPressureMeanRight9());

            double forePressureValue_left = Double.parseDouble(leftPressureList.get(1)) + Double.parseDouble(leftPressureList.get(7)) + Double.parseDouble(leftPressureList.get(8));
            double forePressureValue_right = Double.parseDouble(rightPressureList.get(1)) + Double.parseDouble(rightPressureList.get(7)) + Double.parseDouble(rightPressureList.get(8));
            double percentage_left = NumberUtil.div(forePressureValue_left, forePressureValue_left + forePressureValue_right, 3);
            double percentage_right = NumberUtil.div(forePressureValue_right, forePressureValue_left + forePressureValue_right, 3);
            double real_percentage_left = NumberUtil.mul(percentage_left, 100);
            double real_percentage_right = NumberUtil.mul(percentage_right, 100);

            pictureData.put("offset_fore1_left", percentage_left);
            pictureData.put("offset_fore1_right", percentage_right);

            DefaultPieDataset dateSet = new DefaultPieDataset();
            dateSet.setValue("左脚", real_percentage_left);
            dateSet.setValue("右脚", real_percentage_right);

            JFreeChart chart = ChartFactory.createRingChart(null,  //标题
                    dateSet,
                    false,
                    false,
                    false);

            chart.setBackgroundPaint(new GradientPaint(0, 0, new Color(255, 255, 255),
                    428,428,new Color(255, 255, 255)));
            chart.setBackgroundImageAlpha(0.8f);
            chart.setTextAntiAlias(false);

            RingPlot ringPlot =(RingPlot)chart.getPlot();

            ringPlot.setLabelFont(new Font("微软雅黑", Font.PLAIN, 20));
            ringPlot.setLabelGap(0.02D);
            ringPlot.setLabelBackgroundPaint(Color.white);
            ringPlot.setLabelOutlinePaint(Color.white);
            ringPlot.setMaximumLabelWidth(0.1D);
            ringPlot.setSeparatorsVisible(false);

            //下面设置的是:饼图里面的百分比去除标签边框,只显示百分比的数据 (4个都要设置,缺一不可)
            ringPlot.setLabelOutlinePaint(null);// (1)自定义标签产生器,设置绘图面板外边的填充颜色
            ringPlot.setLabelShadowPaint(null);//自定义标签产生器, 设置绘图面板阴影的填充颜色
            ringPlot.setLabelOutlineStroke(null);//(2) 自定义标签产生器,设置绘图面板外边的填充颜色
            ringPlot.setLabelBackgroundPaint(null);//自定义标签产生器,背景色
            //上面设置的是:饼图里面的百分比去除标签边框,只显示百分比的数据


            ringPlot.setCircular(true);
            ringPlot.setOutlinePaint(Color.white);
            ringPlot.setOutlineStroke(new BasicStroke(10));
            ringPlot.setSectionOutlinesVisible(false);
            ringPlot.setBackgroundPaint(Color.white);

            //设置开始角度
            ringPlot.setStartAngle(90D);
            //设置为顺时针方向
            ringPlot.setDirection(Rotation.CLOCKWISE);
            //设置透明度， 0.5F为半透明，1为不透明，0为全透明
            ringPlot.setForegroundAlpha(0.9f);
            ringPlot.setShadowPaint(null);

            //设置每部分颜色
            ringPlot.setSectionPaint("左脚", Color.decode("#EC5F74"));
            ringPlot.setSectionPaint("右脚", Color.decode("#56CA95"));
            // 设置深度，即带颜色圆环的宽度
            ringPlot.setSectionDepth(0.35d);

            DecimalFormat df = new DecimalFormat("0.0%");
            NumberFormat nf = NumberFormat.getNumberInstance();
            StandardPieSectionLabelGenerator sp = new StandardPieSectionLabelGenerator("{2}", nf, df);
            ringPlot.setLabelGenerator(sp);

//            JFreeChart chart = ChartFactory.createBarChart(null, //标题
//                    null, //目录轴的显示标签
//                    "前足区域比(%)", //数值的显示标签
//                    dateSet, //数据
//                    PlotOrientation.VERTICAL, //图标方向:水平/垂直
//                    true,  //是否显示图例
//                    false, //是否生成工具
//                    false); //是否生成URL链接
//
//            LegendTitle legend = chart.getLegend(); // 图例
//            legend.setItemFont(new Font("黑体", Font.BOLD, 20));
//
//            CategoryPlot categoryPlot = chart.getCategoryPlot();//图部分
//            categoryPlot.setBackgroundPaint(ChartColor.WHITE); // 设置图的背景颜色
//            chart.getLegend().setItemFont( new Font("黑体",Font.BOLD,20));//图标字体
//            CategoryAxis domainAxis = categoryPlot.getDomainAxis();//X轴
//
//            domainAxis.setCategoryLabelPositions(CategoryLabelPositions.STANDARD);//X轴下标  90°显示
//            domainAxis.setMaximumCategoryLabelLines(10);//自动换行    最多显示多少行
//            domainAxis.setLabelFont(new Font("黑体",Font.BOLD,20));//下标
//            domainAxis.setTickLabelFont(new Font("宋体",Font.BOLD,20));//X轴标题
//            domainAxis.setAxisLineVisible(true);
//
//            ValueAxis rangeAxis = categoryPlot.getRangeAxis();//Y轴
//            rangeAxis.setLabelFont(new Font("黑体",Font.BOLD,20));//下标
//            rangeAxis.setTickLabelFont(new Font("宋体",Font.BOLD,20));//Y轴标题
//            rangeAxis.setLowerMargin(0); // 纵轴与底部的距离
//            rangeAxis.setAxisLineVisible(true);
//
//            NumberAxis numberAxis = (NumberAxis) categoryPlot.getRangeAxis();
//            numberAxis.setAutoTickUnitSelection(false); // 是否自动设置Y轴刻度
//            numberAxis.setTickUnit(new NumberTickUnit(10));//刻度大小
//            numberAxis.setAutoRangeStickyZero(true);//和下面一行搭配使用   设置Y轴都是正数
//            numberAxis.setRangeType(RangeType.POSITIVE);
//            numberAxis.setNumberFormatOverride(new DecimalFormat("#"));//设置Y轴上的数值精度
//            numberAxis.setRangeWithMargins(0, 100);
//
//            BarRenderer renderer = (BarRenderer) categoryPlot.getRenderer();//图形修改
//            renderer.setItemMargin(0);//设置柱子之间的距离
//            renderer.setPositiveItemLabelPositionFallback(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER));
//            renderer.setDrawBarOutline(false);
//            renderer.setMaximumBarWidth(0.3); //设置柱子宽度
//            renderer.setMinimumBarLength(0); //设置柱子高度
//            renderer.setSeriesPaint(0, Color.decode("#EC5F74")); // 设置柱子的颜色
//            renderer.setSeriesPaint(1, Color.decode("#56CA95"));  // 设置柱子的颜色
//
//            renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}%" , NumberFormat.getInstance())); // 设置数值显示,格式是百分比
//            renderer.setBaseItemLabelsVisible(true);
//            renderer.setBaseItemLabelFont(new Font("黑体",Font.BOLD,20));
//            renderer.setBaseItemLabelPaint(ChartColor.BLACK);

            File file = new File(this.tempImageDir);
            if (!file.exists()) file.mkdir();
            String foreFootPath = this.tempImageDir + File.separator + "foreFoot.jpg";
            fos = new FileOutputStream(foreFootPath);
            ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        } finally {
            try {
                if (fos!=null) fos.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    /**
     * 生成后足区域比图
     * @param featureData
     * @param width
     * @param height
     * @return
     */
    private boolean generateHindFoot(FeatureData featureData, int width, int height) {
        FileOutputStream fos = null;
        try {
            List<String> leftPressureList = new ArrayList<>();
            leftPressureList.add(featureData.getPressureMeanLeft1());
            leftPressureList.add(featureData.getPressureMeanLeft2());
            leftPressureList.add(featureData.getPressureMeanLeft3());
            leftPressureList.add(featureData.getPressureMeanLeft4());
            leftPressureList.add(featureData.getPressureMeanLeft5());
            leftPressureList.add(featureData.getPressureMeanLeft6());
            leftPressureList.add(featureData.getPressureMeanLeft7());
            leftPressureList.add(featureData.getPressureMeanLeft8());
            leftPressureList.add(featureData.getPressureMeanLeft9());

            List<String> rightPressureList = new ArrayList<>();
            rightPressureList.add(featureData.getPressureMeanRigh1());
            rightPressureList.add(featureData.getPressureMeanRight2());
            rightPressureList.add(featureData.getPressureMeanRight3());
            rightPressureList.add(featureData.getPressureMeanRight4());
            rightPressureList.add(featureData.getPressureMeanRight5());
            rightPressureList.add(featureData.getPressureMeanRight6());
            rightPressureList.add(featureData.getPressureMeanRight7());
            rightPressureList.add(featureData.getPressureMeanRight8());
            rightPressureList.add(featureData.getPressureMeanRight9());

            double hindPressureValue_left = Double.parseDouble(leftPressureList.get(3)) + Double.parseDouble(leftPressureList.get(4)) + Double.parseDouble(leftPressureList.get(5));
            double hindPressureValue_right = Double.parseDouble(rightPressureList.get(3)) + Double.parseDouble(rightPressureList.get(4)) + Double.parseDouble(rightPressureList.get(5));
            double percentage_left = NumberUtil.div(hindPressureValue_left, hindPressureValue_left + hindPressureValue_right, 3);
            double percentage_right = NumberUtil.div(hindPressureValue_right, hindPressureValue_left + hindPressureValue_right, 3);
            double real_percentage_left = NumberUtil.mul(percentage_left, 100);
            double real_percentage_right = NumberUtil.mul(percentage_right, 100);

            pictureData.put("offset_hind_left", percentage_left);
            pictureData.put("offset_hind_right", percentage_right);

            DefaultPieDataset dateSet = new DefaultPieDataset();
            dateSet.setValue("左脚", real_percentage_left);
            dateSet.setValue("右脚", real_percentage_right);

            JFreeChart chart = ChartFactory.createRingChart(null,  //标题
                    dateSet,
                    false,
                    false,
                    false);

            chart.setBackgroundPaint(new GradientPaint(0, 0, new Color(255, 255, 255),
                    428,428,new Color(255, 255, 255)));
            chart.setBackgroundImageAlpha(0.8f);
            chart.setTextAntiAlias(false);

            RingPlot ringPlot =(RingPlot)chart.getPlot();

            ringPlot.setLabelFont(new Font("微软雅黑", Font.PLAIN, 20));
            ringPlot.setLabelGap(0.02D);
            ringPlot.setLabelBackgroundPaint(Color.white);
            ringPlot.setLabelOutlinePaint(Color.white);
            ringPlot.setMaximumLabelWidth(0.1D);
            ringPlot.setSeparatorsVisible(false);

            //下面设置的是:饼图里面的百分比去除标签边框,只显示百分比的数据 (4个都要设置,缺一不可)
            ringPlot.setLabelOutlinePaint(null);// (1)自定义标签产生器,设置绘图面板外边的填充颜色
            ringPlot.setLabelShadowPaint(null);//自定义标签产生器, 设置绘图面板阴影的填充颜色
            ringPlot.setLabelOutlineStroke(null);//(2) 自定义标签产生器,设置绘图面板外边的填充颜色
            ringPlot.setLabelBackgroundPaint(null);//自定义标签产生器,背景色
            //上面设置的是:饼图里面的百分比去除标签边框,只显示百分比的数据


            ringPlot.setCircular(true);
            ringPlot.setOutlinePaint(Color.white);
            ringPlot.setOutlineStroke(new BasicStroke(10));
            ringPlot.setSectionOutlinesVisible(false);
            ringPlot.setBackgroundPaint(Color.white);

            //设置开始角度
            ringPlot.setStartAngle(90D);
            //设置为顺时针方向
            ringPlot.setDirection(Rotation.CLOCKWISE);
            //设置透明度， 0.5F为半透明，1为不透明，0为全透明
            ringPlot.setForegroundAlpha(0.9f);
            ringPlot.setShadowPaint(null);

            //设置每部分颜色
            ringPlot.setSectionPaint("左脚", Color.decode("#EC5F74"));
            ringPlot.setSectionPaint("右脚", Color.decode("#56CA95"));
            // 设置深度，即带颜色圆环的宽度
            ringPlot.setSectionDepth(0.35d);

            DecimalFormat df = new DecimalFormat("0.0%");
            NumberFormat nf = NumberFormat.getNumberInstance();
            StandardPieSectionLabelGenerator sp = new StandardPieSectionLabelGenerator("{2}", nf, df);
            ringPlot.setLabelGenerator(sp);

//            DefaultCategoryDataset dateSet = new DefaultCategoryDataset();
//            dateSet.setValue(real_percentage_left, "左脚", "");
//            dateSet.setValue(real_percentage_right, "右脚", "");
//
//            JFreeChart chart = ChartFactory.createBarChart(null, //标题
//                    null, //目录轴的显示标签
//                    "后足区域比(%)", //数值的显示标签
//                    dateSet, //数据
//                    PlotOrientation.VERTICAL, //图标方向:水平/垂直
//                    true,  //是否显示图例
//                    false, //是否生成工具
//                    false); //是否生成URL链接
//
//
//            LegendTitle legend = chart.getLegend(); // 图例
//            legend.setItemFont(new Font("黑体", Font.BOLD, 20));
//
//            CategoryPlot categoryPlot = chart.getCategoryPlot();//图部分
//            categoryPlot.setBackgroundPaint(ChartColor.WHITE); // 设置图的背景颜色
//            chart.getLegend().setItemFont( new Font("黑体",Font.BOLD,20));//图标字体
//            CategoryAxis domainAxis = categoryPlot.getDomainAxis();//X轴
//
//            domainAxis.setCategoryLabelPositions(CategoryLabelPositions.STANDARD);//X轴下标  90°显示
//            domainAxis.setMaximumCategoryLabelLines(10);//自动换行    最多显示多少行
//            domainAxis.setLabelFont(new Font("黑体",Font.BOLD,20));//下标
//            domainAxis.setTickLabelFont(new Font("宋体",Font.BOLD,20));//X轴标题
//            domainAxis.setAxisLineVisible(true);
//
//            ValueAxis rangeAxis = categoryPlot.getRangeAxis();//Y轴
//            rangeAxis.setLabelFont(new Font("黑体",Font.BOLD,20));//下标
//            rangeAxis.setTickLabelFont(new Font("宋体",Font.BOLD,20));//Y轴标题
//            rangeAxis.setLowerMargin(0); // 纵轴与底部的距离
//            rangeAxis.setAxisLineVisible(true);
//
//            NumberAxis numberAxis = (NumberAxis) categoryPlot.getRangeAxis();
//            numberAxis.setAutoTickUnitSelection(false); // 是否自动设置Y轴刻度
//            numberAxis.setTickUnit(new NumberTickUnit(10));//刻度大小
//            numberAxis.setAutoRangeStickyZero(true);//和下面一行搭配使用   设置Y轴都是正数
//            numberAxis.setRangeType(RangeType.POSITIVE);
//            numberAxis.setNumberFormatOverride(new DecimalFormat("#"));//设置Y轴上的数值精度
//            numberAxis.setRangeWithMargins(0, 100);
//
//            BarRenderer renderer = (BarRenderer) categoryPlot.getRenderer();//图形修改
//            renderer.setItemMargin(0);//设置柱子之间的距离
//            renderer.setPositiveItemLabelPositionFallback(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER));
//            renderer.setDrawBarOutline(false);
//            renderer.setMaximumBarWidth(0.3); //设置柱子宽度
//            renderer.setMinimumBarLength(0); //设置柱子高度
//            renderer.setSeriesPaint(0, Color.decode("#EC5F74")); // 设置柱子的颜色
//            renderer.setSeriesPaint(1, Color.decode("#56CA95"));  // 设置柱子的颜色
//
//            renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}%" , NumberFormat.getInstance())); // 设置数值显示,格式是百分比
//            renderer.setBaseItemLabelsVisible(true);
//            renderer.setBaseItemLabelFont(new Font("黑体",Font.BOLD,20));
//            renderer.setBaseItemLabelPaint(ChartColor.BLACK);

            File file = new File(this.tempImageDir);
            if (!file.exists()) file.mkdir();
            String hindFootPath = this.tempImageDir + File.separator + "hindFoot.jpg";
            fos = new FileOutputStream(hindFootPath);
            ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        } finally {
            try {
                if (fos!=null) fos.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    /**
     * 生成中足区域比图
     * @param featureData
     * @param width
     * @param height
     * @return
     */
    private boolean generateMidFoot(FeatureData featureData, int width, int height) {
        FileOutputStream fos = null;
        try {
            List<String> leftPressureList = new ArrayList<>();
            leftPressureList.add(featureData.getPressureMeanLeft1());
            leftPressureList.add(featureData.getPressureMeanLeft2());
            leftPressureList.add(featureData.getPressureMeanLeft3());
            leftPressureList.add(featureData.getPressureMeanLeft4());
            leftPressureList.add(featureData.getPressureMeanLeft5());
            leftPressureList.add(featureData.getPressureMeanLeft6());
            leftPressureList.add(featureData.getPressureMeanLeft7());
            leftPressureList.add(featureData.getPressureMeanLeft8());
            leftPressureList.add(featureData.getPressureMeanLeft9());

            List<String> rightPressureList = new ArrayList<>();
            rightPressureList.add(featureData.getPressureMeanRigh1());
            rightPressureList.add(featureData.getPressureMeanRight2());
            rightPressureList.add(featureData.getPressureMeanRight3());
            rightPressureList.add(featureData.getPressureMeanRight4());
            rightPressureList.add(featureData.getPressureMeanRight5());
            rightPressureList.add(featureData.getPressureMeanRight6());
            rightPressureList.add(featureData.getPressureMeanRight7());
            rightPressureList.add(featureData.getPressureMeanRight8());
            rightPressureList.add(featureData.getPressureMeanRight9());

            double midPressureValue_left = Double.parseDouble(leftPressureList.get(2)) + Double.parseDouble(leftPressureList.get(6));
            double midPressureValue_right = Double.parseDouble(rightPressureList.get(2)) + Double.parseDouble(rightPressureList.get(6));
            double percentage_left = NumberUtil.div(midPressureValue_left, midPressureValue_left + midPressureValue_right, 3);
            double percentage_right = NumberUtil.div(midPressureValue_right, midPressureValue_left + midPressureValue_right, 3);
            double real_percentage_left = NumberUtil.mul(percentage_left, 100);
            double real_percentage_right = NumberUtil.mul(percentage_right, 100);

            pictureData.put("offset_mid_left", percentage_left);
            pictureData.put("offset_mid_right", percentage_right);

            DefaultPieDataset dateSet = new DefaultPieDataset();
            dateSet.setValue("左脚", real_percentage_left);
            dateSet.setValue("右脚", real_percentage_right);

            JFreeChart chart = ChartFactory.createRingChart(null,  //标题
                    dateSet,
                    false,
                    false,
                    false);

            chart.setBackgroundPaint(new GradientPaint(0, 0, new Color(255, 255, 255),
                    428,428,new Color(255, 255, 255)));
            chart.setBackgroundImageAlpha(0.8f);
            chart.setTextAntiAlias(false);

            RingPlot ringPlot =(RingPlot)chart.getPlot();

            ringPlot.setLabelFont(new Font("微软雅黑", Font.PLAIN, 20));
            ringPlot.setLabelGap(0.02D);
            ringPlot.setLabelBackgroundPaint(Color.white);
            ringPlot.setLabelOutlinePaint(Color.white);
            ringPlot.setMaximumLabelWidth(0.1D);
            ringPlot.setSeparatorsVisible(false);

            //下面设置的是:饼图里面的百分比去除标签边框,只显示百分比的数据 (4个都要设置,缺一不可)
            ringPlot.setLabelOutlinePaint(null);// (1)自定义标签产生器,设置绘图面板外边的填充颜色
            ringPlot.setLabelShadowPaint(null);//自定义标签产生器, 设置绘图面板阴影的填充颜色
            ringPlot.setLabelOutlineStroke(null);//(2) 自定义标签产生器,设置绘图面板外边的填充颜色
            ringPlot.setLabelBackgroundPaint(null);//自定义标签产生器,背景色
            //上面设置的是:饼图里面的百分比去除标签边框,只显示百分比的数据

            ringPlot.setCircular(true);
            ringPlot.setOutlinePaint(Color.white);
            ringPlot.setOutlineStroke(new BasicStroke(10));
            ringPlot.setSectionOutlinesVisible(false);
            ringPlot.setBackgroundPaint(Color.white);

            //设置开始角度
            ringPlot.setStartAngle(90D);
            //设置为顺时针方向
            ringPlot.setDirection(Rotation.CLOCKWISE);
            //设置透明度， 0.5F为半透明，1为不透明，0为全透明
            ringPlot.setForegroundAlpha(0.9f);
            ringPlot.setShadowPaint(null);

            //设置每部分颜色
            ringPlot.setSectionPaint("左脚", Color.decode("#EC5F74"));
            ringPlot.setSectionPaint("右脚", Color.decode("#56CA95"));
            // 设置深度，即带颜色圆环的宽度
            ringPlot.setSectionDepth(0.35d);

            DecimalFormat df = new DecimalFormat("0.0%");
            NumberFormat nf = NumberFormat.getNumberInstance();
            StandardPieSectionLabelGenerator sp = new StandardPieSectionLabelGenerator("{2}", nf, df);
            ringPlot.setLabelGenerator(sp);

//            DefaultCategoryDataset dateSet = new DefaultCategoryDataset();
//            dateSet.setValue(real_percentage_left, "左脚", "");
//            dateSet.setValue(real_percentage_right, "右脚", "");
//
//            JFreeChart chart = ChartFactory.createBarChart(null, //标题
//                    null, //目录轴的显示标签
//                    "中足区域比(%)", //数值的显示标签
//                    dateSet, //数据
//                    PlotOrientation.VERTICAL, //图标方向:水平/垂直
//                    true,  //是否显示图例
//                    false, //是否生成工具
//                    false); //是否生成URL链接
//
//
//            LegendTitle legend = chart.getLegend(); // 图例
//            legend.setItemFont(new Font("黑体", Font.BOLD, 20));
//
//            CategoryPlot categoryPlot = chart.getCategoryPlot();//图部分
//            categoryPlot.setBackgroundPaint(ChartColor.WHITE); // 设置图的背景颜色
//            chart.getLegend().setItemFont( new Font("黑体",Font.BOLD,20));//图标字体
//            CategoryAxis domainAxis = categoryPlot.getDomainAxis();//X轴
//
//            domainAxis.setCategoryLabelPositions(CategoryLabelPositions.STANDARD);//X轴下标  90°显示
//            domainAxis.setMaximumCategoryLabelLines(10);//自动换行    最多显示多少行
//            domainAxis.setLabelFont(new Font("黑体",Font.BOLD,20));//下标
//            domainAxis.setTickLabelFont(new Font("宋体",Font.BOLD,20));//X轴标题
//            domainAxis.setAxisLineVisible(true);
//
//            ValueAxis rangeAxis = categoryPlot.getRangeAxis();//Y轴
//            rangeAxis.setLabelFont(new Font("黑体",Font.BOLD,20));//下标
//            rangeAxis.setTickLabelFont(new Font("宋体",Font.BOLD,20));//Y轴标题
//            rangeAxis.setLowerMargin(0); // 纵轴与底部的距离
//            rangeAxis.setAxisLineVisible(true);
//
//            NumberAxis numberAxis = (NumberAxis) categoryPlot.getRangeAxis();
//            numberAxis.setAutoTickUnitSelection(false); // 是否自动设置Y轴刻度
//            numberAxis.setTickUnit(new NumberTickUnit(10));//刻度大小
//            numberAxis.setAutoRangeStickyZero(true);//和下面一行搭配使用   设置Y轴都是正数
//            numberAxis.setRangeType(RangeType.POSITIVE);
//            numberAxis.setNumberFormatOverride(new DecimalFormat("#"));//设置Y轴上的数值精度
//            numberAxis.setRangeWithMargins(0, 100);
//
//            BarRenderer renderer = (BarRenderer) categoryPlot.getRenderer();//图形修改
//            renderer.setItemMargin(0);//设置柱子之间的距离
//            renderer.setPositiveItemLabelPositionFallback(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER));
//            renderer.setDrawBarOutline(false);
//            renderer.setMaximumBarWidth(0.3); //设置柱子宽度
//            renderer.setMinimumBarLength(0); //设置柱子高度
//            renderer.setSeriesPaint(0, Color.decode("#EC5F74")); // 设置柱子的颜色
//            renderer.setSeriesPaint(1, Color.decode("#56CA95"));  // 设置柱子的颜色
//
//            renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}%" , NumberFormat.getInstance())); // 设置数值显示,格式是百分比
//            renderer.setBaseItemLabelsVisible(true);
//            renderer.setBaseItemLabelFont(new Font("黑体",Font.BOLD,20));
//            renderer.setBaseItemLabelPaint(ChartColor.BLACK);

            File file = new File(this.tempImageDir);
            if (!file.exists()) file.mkdir();
            String midFootPath = this.tempImageDir + File.separator + "midFoot.jpg";
            fos = new FileOutputStream(midFootPath);
            ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        } finally {
            try {
                if (fos!=null) fos.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    /**
     * 生成左足的前后足区域比图   "leftForeHind.jpg"
     * @param featureData
     * @param width
     * @param height
     * @return
     */
    private boolean generateLeftForeHind(FeatureData featureData, int width, int height) {
        FileOutputStream fos = null;
        try {

            List<String> leftPressureList = new ArrayList<>();
            leftPressureList.add(featureData.getPressureMeanLeft1());
            leftPressureList.add(featureData.getPressureMeanLeft2());
            leftPressureList.add(featureData.getPressureMeanLeft3());
            leftPressureList.add(featureData.getPressureMeanLeft4());
            leftPressureList.add(featureData.getPressureMeanLeft5());
            leftPressureList.add(featureData.getPressureMeanLeft6());
            leftPressureList.add(featureData.getPressureMeanLeft7());
            leftPressureList.add(featureData.getPressureMeanLeft8());
            leftPressureList.add(featureData.getPressureMeanLeft9());

            double forePressureValue_left = Double.parseDouble(leftPressureList.get(0)) + Double.parseDouble(leftPressureList.get(1)) + Double.parseDouble(leftPressureList.get(7)) + Double.parseDouble(leftPressureList.get(8));
            double hindPressureValue_left = Double.parseDouble(leftPressureList.get(3)) + Double.parseDouble(leftPressureList.get(4)) + Double.parseDouble(leftPressureList.get(5));

            double percentage_fore = NumberUtil.div(forePressureValue_left, forePressureValue_left + hindPressureValue_left, 3);
            double percentage_hind = NumberUtil.div(hindPressureValue_left, forePressureValue_left + hindPressureValue_left, 3);
            double real_percentage_fore = NumberUtil.mul(percentage_fore, 100);
            double real_percentage_hind = NumberUtil.mul(percentage_hind, 100);

            pictureData.put("foreHind_left_fore", percentage_fore);
            pictureData.put("foreHind_left_hind", percentage_hind);

            DefaultPieDataset dateSet = new DefaultPieDataset();
            dateSet.setValue("前足", real_percentage_fore);
            dateSet.setValue("后足", real_percentage_hind);

            JFreeChart chart = ChartFactory.createRingChart(null,  //标题
                    dateSet,
                    false,
                    false,
                    false);

            chart.setBackgroundPaint(new GradientPaint(0, 0, new Color(255, 255, 255),
                    428,428,new Color(255, 255, 255)));
            chart.setBackgroundImageAlpha(0.8f);
            chart.setTextAntiAlias(false);

            RingPlot ringPlot =(RingPlot)chart.getPlot();

            ringPlot.setLabelFont(new Font("微软雅黑", Font.PLAIN, 20));
            ringPlot.setLabelGap(0.02D);
            ringPlot.setLabelBackgroundPaint(Color.white);
            ringPlot.setLabelOutlinePaint(Color.white);
            ringPlot.setMaximumLabelWidth(0.1D);

            //下面设置的是:饼图里面的百分比去除标签边框,只显示百分比的数据 (4个都要设置,缺一不可)
            ringPlot.setLabelOutlinePaint(null);// (1)自定义标签产生器,设置绘图面板外边的填充颜色
            ringPlot.setLabelShadowPaint(null);//自定义标签产生器, 设置绘图面板阴影的填充颜色
            ringPlot.setLabelOutlineStroke(null);//(2) 自定义标签产生器,设置绘图面板外边的填充颜色
            ringPlot.setLabelBackgroundPaint(null);//自定义标签产生器,背景色
            //上面设置的是:饼图里面的百分比去除标签边框,只显示百分比的数据

            ringPlot.setCircular(true);
            ringPlot.setOutlinePaint(Color.white);
            ringPlot.setOutlineStroke(new BasicStroke(10));
            ringPlot.setSectionOutlinesVisible(false);
            ringPlot.setBackgroundPaint(Color.white);
            ringPlot.setSeparatorsVisible(false);

            //设置开始角度
            ringPlot.setStartAngle(90D);
            //设置为顺时针方向
            ringPlot.setDirection(Rotation.CLOCKWISE);
            //设置透明度， 0.5F为半透明，1为不透明，0为全透明
            ringPlot.setForegroundAlpha(0.9f);
            ringPlot.setShadowPaint(null);

            //设置每部分颜色
            ringPlot.setSectionPaint("前足", Color.decode("#FF9609"));
            ringPlot.setSectionPaint("后足", Color.decode("#B0B0B0"));
            // 设置深度，即带颜色圆环的宽度
            ringPlot.setSectionDepth(0.35d);

            DecimalFormat df = new DecimalFormat("0.0%");
            NumberFormat nf = NumberFormat.getNumberInstance();
            StandardPieSectionLabelGenerator sp = new StandardPieSectionLabelGenerator("{2}", nf, df);
            ringPlot.setLabelGenerator(sp);

//            DefaultCategoryDataset dateSet = new DefaultCategoryDataset();
//            dateSet.setValue(real_percentage_fore, "前足", "");
//            dateSet.setValue(real_percentage_hind, "后足", "");
//
//            JFreeChart chart = ChartFactory.createBarChart(null, //标题
//                    null, //目录轴的显示标签
//                    "左足区域比(%)", //数值的显示标签
//                    dateSet, //数据
//                    PlotOrientation.VERTICAL, //图标方向:水平/垂直
//                    true,  //是否显示图例
//                    false, //是否生成工具
//                    false); //是否生成URL链接
//
//            LegendTitle legend = chart.getLegend(); // 图例
//            legend.setItemFont(new Font("黑体", Font.BOLD, 20));
//
//            CategoryPlot categoryPlot = chart.getCategoryPlot();//图部分
//            categoryPlot.setBackgroundPaint(ChartColor.WHITE); // 设置图的背景颜色
//            chart.getLegend().setItemFont( new Font("黑体",Font.BOLD,20));//图标字体
//            CategoryAxis domainAxis = categoryPlot.getDomainAxis();//X轴
//
//            domainAxis.setCategoryLabelPositions(CategoryLabelPositions.STANDARD);//X轴下标  90°显示
//            domainAxis.setMaximumCategoryLabelLines(10);//自动换行    最多显示多少行
//            domainAxis.setLabelFont(new Font("黑体",Font.BOLD,20));//下标
//            domainAxis.setTickLabelFont(new Font("宋体",Font.BOLD,20));//X轴标题
//            domainAxis.setAxisLineVisible(true);
//
//            ValueAxis rangeAxis = categoryPlot.getRangeAxis();//Y轴
//            rangeAxis.setLabelFont(new Font("黑体",Font.BOLD,20));//下标
//            rangeAxis.setTickLabelFont(new Font("宋体",Font.BOLD,20));//Y轴标题
//            rangeAxis.setLowerMargin(0); // 纵轴与底部的距离
//            rangeAxis.setAxisLineVisible(true);
//
//            NumberAxis numberAxis = (NumberAxis) categoryPlot.getRangeAxis();
//            numberAxis.setAutoTickUnitSelection(false); // 是否自动设置Y轴刻度
//            numberAxis.setTickUnit(new NumberTickUnit(10));//刻度大小
//            numberAxis.setAutoRangeStickyZero(true);//和下面一行搭配使用   设置Y轴都是正数
//            numberAxis.setRangeType(RangeType.POSITIVE);
//            numberAxis.setNumberFormatOverride(new DecimalFormat("#"));//设置Y轴上的数值精度
//            numberAxis.setRangeWithMargins(0, 100);
//
//            BarRenderer renderer = (BarRenderer) categoryPlot.getRenderer();//图形修改
//            renderer.setItemMargin(0);//设置柱子之间的距离
//            renderer.setPositiveItemLabelPositionFallback(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER));
//            renderer.setDrawBarOutline(false);
//            renderer.setMaximumBarWidth(0.3); //设置柱子宽度
//            renderer.setMinimumBarLength(0); //设置柱子高度
//            renderer.setSeriesPaint(0, Color.decode("#FF9609")); // 设置柱子的颜色
//            renderer.setSeriesPaint(1, Color.decode("#B0B0B0"));  // 设置柱子的颜色
//
//            renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}%" , NumberFormat.getInstance())); // 设置数值显示,格式是百分比
//            renderer.setBaseItemLabelsVisible(true);
//            renderer.setBaseItemLabelFont(new Font("黑体",Font.BOLD,20));
//            renderer.setBaseItemLabelPaint(ChartColor.BLACK);

            File file = new File(this.tempImageDir);
            if (!file.exists()) file.mkdir();
            String otherForeFootPath = this.tempImageDir + File.separator + "leftForeHind.jpg";
            fos = new FileOutputStream(otherForeFootPath);
            ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        } finally {
            try {
                if (fos!=null) fos.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    /**
     * 生成右足的前后足区域比图   "rightForeHind.jpg"
     * @param featureData
     * @param width
     * @param height
     * @return
     */
    private boolean generateRightForeHind(FeatureData featureData, int width, int height) {
        FileOutputStream fos = null;
        try {

            List<String> rightPressureList = new ArrayList<>();
            rightPressureList.add(featureData.getPressureMeanRigh1());
            rightPressureList.add(featureData.getPressureMeanRight2());
            rightPressureList.add(featureData.getPressureMeanRight3());
            rightPressureList.add(featureData.getPressureMeanRight4());
            rightPressureList.add(featureData.getPressureMeanRight5());
            rightPressureList.add(featureData.getPressureMeanRight6());
            rightPressureList.add(featureData.getPressureMeanRight7());
            rightPressureList.add(featureData.getPressureMeanRight8());
            rightPressureList.add(featureData.getPressureMeanRight9());

            double forePressureValue_right = Double.parseDouble(rightPressureList.get(0)) + Double.parseDouble(rightPressureList.get(1)) + Double.parseDouble(rightPressureList.get(7)) + Double.parseDouble(rightPressureList.get(8));
            double hindPressureValue_right = Double.parseDouble(rightPressureList.get(3)) + Double.parseDouble(rightPressureList.get(4)) + Double.parseDouble(rightPressureList.get(5));

            double percentage_fore = NumberUtil.div(forePressureValue_right, forePressureValue_right + hindPressureValue_right, 3);
            double percentage_hind = NumberUtil.div(hindPressureValue_right, forePressureValue_right + hindPressureValue_right, 3);
            double real_percentage_fore = NumberUtil.mul(percentage_fore, 100);
            double real_percentage_hind = NumberUtil.mul(percentage_hind, 100);

            pictureData.put("foreHind_left_fore", percentage_fore);
            pictureData.put("foreHind_left_hind", percentage_hind);

            DefaultPieDataset dateSet = new DefaultPieDataset();
            dateSet.setValue("前足", real_percentage_fore);
            dateSet.setValue("后足", real_percentage_hind);

            JFreeChart chart = ChartFactory.createRingChart(null,  //标题
                    dateSet,
                    false,
                    false,
                    false);

            chart.setBackgroundPaint(new GradientPaint(0, 0, new Color(255, 255, 255),
                    428,428,new Color(255, 255, 255)));
            chart.setBackgroundImageAlpha(0.8f);
            chart.setTextAntiAlias(false);

            RingPlot ringPlot =(RingPlot)chart.getPlot();

            ringPlot.setLabelFont(new Font("微软雅黑", Font.PLAIN, 20));
            ringPlot.setLabelGap(0.02D);
            ringPlot.setLabelBackgroundPaint(Color.white);
            ringPlot.setLabelOutlinePaint(Color.white);
            ringPlot.setMaximumLabelWidth(0.1D);

            //下面设置的是:饼图里面的百分比去除标签边框,只显示百分比的数据 (4个都要设置,缺一不可)
            ringPlot.setLabelOutlinePaint(null);// (1)自定义标签产生器,设置绘图面板外边的填充颜色
            ringPlot.setLabelShadowPaint(null);//自定义标签产生器, 设置绘图面板阴影的填充颜色
            ringPlot.setLabelOutlineStroke(null);//(2) 自定义标签产生器,设置绘图面板外边的填充颜色
            ringPlot.setLabelBackgroundPaint(null);//自定义标签产生器,背景色
            //上面设置的是:饼图里面的百分比去除标签边框,只显示百分比的数据

            ringPlot.setCircular(true);
            ringPlot.setOutlinePaint(Color.white);
            ringPlot.setOutlineStroke(new BasicStroke(10));
            ringPlot.setSectionOutlinesVisible(false);
            ringPlot.setBackgroundPaint(Color.white);
            ringPlot.setSeparatorsVisible(false);

            //设置开始角度
            ringPlot.setStartAngle(90D);
            //设置为顺时针方向
            ringPlot.setDirection(Rotation.CLOCKWISE);
            //设置透明度， 0.5F为半透明，1为不透明，0为全透明
            ringPlot.setForegroundAlpha(0.9f);
            ringPlot.setShadowPaint(null);

            //设置每部分颜色
            ringPlot.setSectionPaint("前足", Color.decode("#FF9609"));
            ringPlot.setSectionPaint("后足", Color.decode("#B0B0B0"));
            // 设置深度，即带颜色圆环的宽度
            ringPlot.setSectionDepth(0.35d);

            DecimalFormat df = new DecimalFormat("0.0%");
            NumberFormat nf = NumberFormat.getNumberInstance();
            StandardPieSectionLabelGenerator sp = new StandardPieSectionLabelGenerator("{2}", nf, df);
            ringPlot.setLabelGenerator(sp);

//            DefaultCategoryDataset dateSet = new DefaultCategoryDataset();
//            dateSet.setValue(real_percentage_fore, "前足", "");
//            dateSet.setValue(real_percentage_hind, "后足", "");
//
//            JFreeChart chart = ChartFactory.createBarChart(null, //标题
//                    null, //目录轴的显示标签
//                    "右足区域比(%)", //数值的显示标签
//                    dateSet, //数据
//                    PlotOrientation.VERTICAL, //图标方向:水平/垂直
//                    true,  //是否显示图例
//                    false, //是否生成工具
//                    false); //是否生成URL链接
//
//            LegendTitle legend = chart.getLegend(); // 图例
//            legend.setItemFont(new Font("黑体", Font.BOLD, 20));
//
//            CategoryPlot categoryPlot = chart.getCategoryPlot();//图部分
//            categoryPlot.setBackgroundPaint(ChartColor.WHITE); // 设置图的背景颜色
//            chart.getLegend().setItemFont( new Font("黑体",Font.BOLD,20));//图标字体
//            CategoryAxis domainAxis = categoryPlot.getDomainAxis();//X轴
//
//            domainAxis.setCategoryLabelPositions(CategoryLabelPositions.STANDARD);//X轴下标  90°显示
//            domainAxis.setMaximumCategoryLabelLines(10);//自动换行    最多显示多少行
//            domainAxis.setLabelFont(new Font("黑体",Font.BOLD,20));//下标
//            domainAxis.setTickLabelFont(new Font("宋体",Font.BOLD,20));//X轴标题
//            domainAxis.setAxisLineVisible(true);
//
//            ValueAxis rangeAxis = categoryPlot.getRangeAxis();//Y轴
//            rangeAxis.setLabelFont(new Font("黑体",Font.BOLD,20));//下标
//            rangeAxis.setTickLabelFont(new Font("宋体",Font.BOLD,20));//Y轴标题
//            rangeAxis.setLowerMargin(0); // 纵轴与底部的距离
//            rangeAxis.setAxisLineVisible(true);
//
//            NumberAxis numberAxis = (NumberAxis) categoryPlot.getRangeAxis();
//            numberAxis.setAutoTickUnitSelection(false); // 是否自动设置Y轴刻度
//            numberAxis.setTickUnit(new NumberTickUnit(10));//刻度大小
//            numberAxis.setAutoRangeStickyZero(true);//和下面一行搭配使用   设置Y轴都是正数
//            numberAxis.setRangeType(RangeType.POSITIVE);
//            numberAxis.setNumberFormatOverride(new DecimalFormat("#"));//设置Y轴上的数值精度
//            numberAxis.setRangeWithMargins(0, 100);
//
//            BarRenderer renderer = (BarRenderer) categoryPlot.getRenderer();//图形修改
//            renderer.setItemMargin(0);//设置柱子之间的距离
//            renderer.setPositiveItemLabelPositionFallback(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER));
//            renderer.setDrawBarOutline(false);
//            renderer.setMaximumBarWidth(0.3); //设置柱子宽度
//            renderer.setMinimumBarLength(0); //设置柱子高度
//            renderer.setSeriesPaint(0, Color.decode("#FF9609")); // 设置柱子的颜色
//            renderer.setSeriesPaint(1, Color.decode("#B0B0B0"));  // 设置柱子的颜色
//
//            renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}%" , NumberFormat.getInstance())); // 设置数值显示,格式是百分比
//            renderer.setBaseItemLabelsVisible(true);
//            renderer.setBaseItemLabelFont(new Font("黑体",Font.BOLD,20));
//            renderer.setBaseItemLabelPaint(ChartColor.BLACK);

            File file = new File(this.tempImageDir);
            if (!file.exists()) file.mkdir();
            String rightForeHindPath = this.tempImageDir + File.separator + "rightForeHind.jpg";
            fos = new FileOutputStream(rightForeHindPath);
            ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        } finally {
            try {
                if (fos!=null) fos.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    /**
     * 生成前足+后足的左右足区域比图   "foreHind.jpg"
     * @param featureData
     * @param width
     * @param height
     * @return
     */
    private boolean generateForeHind(FeatureData featureData, int width, int height) {
        FileOutputStream fos = null;
        try {
            List<String> leftPressureList = new ArrayList<>();
            leftPressureList.add(featureData.getPressureMeanLeft1());
            leftPressureList.add(featureData.getPressureMeanLeft2());
            leftPressureList.add(featureData.getPressureMeanLeft3());
            leftPressureList.add(featureData.getPressureMeanLeft4());
            leftPressureList.add(featureData.getPressureMeanLeft5());
            leftPressureList.add(featureData.getPressureMeanLeft6());
            leftPressureList.add(featureData.getPressureMeanLeft7());
            leftPressureList.add(featureData.getPressureMeanLeft8());
            leftPressureList.add(featureData.getPressureMeanLeft9());

            List<String> rightPressureList = new ArrayList<>();
            rightPressureList.add(featureData.getPressureMeanRigh1());
            rightPressureList.add(featureData.getPressureMeanRight2());
            rightPressureList.add(featureData.getPressureMeanRight3());
            rightPressureList.add(featureData.getPressureMeanRight4());
            rightPressureList.add(featureData.getPressureMeanRight5());
            rightPressureList.add(featureData.getPressureMeanRight6());
            rightPressureList.add(featureData.getPressureMeanRight7());
            rightPressureList.add(featureData.getPressureMeanRight8());
            rightPressureList.add(featureData.getPressureMeanRight9());

            double foreHindPressureValue_left = Double.parseDouble(leftPressureList.get(0)) + Double.parseDouble(leftPressureList.get(1)) + Double.parseDouble(leftPressureList.get(7)) + Double.parseDouble(leftPressureList.get(8)) +
                                                Double.parseDouble(leftPressureList.get(3)) + Double.parseDouble(leftPressureList.get(4)) + Double.parseDouble(leftPressureList.get(5));
            double foreHindPressureValue_right = Double.parseDouble(rightPressureList.get(0)) + Double.parseDouble(rightPressureList.get(1)) + Double.parseDouble(rightPressureList.get(7)) + Double.parseDouble(rightPressureList.get(8)) +
                                                 Double.parseDouble(rightPressureList.get(3)) + Double.parseDouble(rightPressureList.get(4)) + Double.parseDouble(rightPressureList.get(5));

            double percentage_left = NumberUtil.div(foreHindPressureValue_left, foreHindPressureValue_left + foreHindPressureValue_right, 3);
            double percentage_right = NumberUtil.div(foreHindPressureValue_right, foreHindPressureValue_left + foreHindPressureValue_right, 3);
            double real_percentage_left = NumberUtil.mul(percentage_left, 100);
            double real_percentage_right = NumberUtil.mul(percentage_right, 100);

            pictureData.put("foreHind_left", percentage_left);
            pictureData.put("foreHind_right", percentage_right);

            DefaultPieDataset dateSet = new DefaultPieDataset();
            dateSet.setValue("左足", real_percentage_left);
            dateSet.setValue("右足", real_percentage_right);

            JFreeChart chart = ChartFactory.createRingChart(null,  //标题
                    dateSet,
                    false,
                    false,
                    false);

            chart.setBackgroundPaint(new GradientPaint(0, 0, new Color(255, 255, 255),
                    428,428,new Color(255, 255, 255)));
            chart.setBackgroundImageAlpha(0.8f);
            chart.setTextAntiAlias(false);

            RingPlot ringPlot =(RingPlot)chart.getPlot();

            ringPlot.setLabelFont(new Font("微软雅黑", Font.PLAIN, 20));
            ringPlot.setLabelGap(0.02D);
            ringPlot.setLabelBackgroundPaint(Color.white);
            ringPlot.setLabelOutlinePaint(Color.white);
            ringPlot.setMaximumLabelWidth(0.1D);

            //下面设置的是:饼图里面的百分比去除标签边框,只显示百分比的数据 (4个都要设置,缺一不可)
            ringPlot.setLabelOutlinePaint(null);// (1)自定义标签产生器,设置绘图面板外边的填充颜色
            ringPlot.setLabelShadowPaint(null);//自定义标签产生器, 设置绘图面板阴影的填充颜色
            ringPlot.setLabelOutlineStroke(null);//(2) 自定义标签产生器,设置绘图面板外边的填充颜色
            ringPlot.setLabelBackgroundPaint(null);//自定义标签产生器,背景色
            //上面设置的是:饼图里面的百分比去除标签边框,只显示百分比的数据

            ringPlot.setCircular(true);
            ringPlot.setOutlinePaint(Color.white);
            ringPlot.setOutlineStroke(new BasicStroke(10));
            ringPlot.setSectionOutlinesVisible(false);
            ringPlot.setBackgroundPaint(Color.white);
            ringPlot.setSeparatorsVisible(false);
//            ringPlot.setSeparatorPaint(Color.WHITE);

            //设置开始角度
            ringPlot.setStartAngle(90D);
            //设置为顺时针方向
            ringPlot.setDirection(Rotation.CLOCKWISE);
            //设置透明度， 0.5F为半透明，1为不透明，0为全透明
            ringPlot.setForegroundAlpha(0.9f);
            ringPlot.setShadowPaint(null);

            //设置每部分颜色
            ringPlot.setSectionPaint("左足", Color.decode("#EC5F74"));
            ringPlot.setSectionPaint("右足", Color.decode("#56CA95"));
            // 设置深度，即带颜色圆环的宽度
            ringPlot.setSectionDepth(0.35d);

            DecimalFormat df = new DecimalFormat("0.0%");
            NumberFormat nf = NumberFormat.getNumberInstance();
            StandardPieSectionLabelGenerator sp = new StandardPieSectionLabelGenerator("{2}", nf, df);
            ringPlot.setLabelGenerator(sp);

//            DefaultCategoryDataset dateSet = new DefaultCategoryDataset();
//            dateSet.setValue(real_percentage_left, "左脚", "");
//            dateSet.setValue(real_percentage_right, "右脚", "");
//
//            JFreeChart chart = ChartFactory.createBarChart(null, //标题
//                    null, //目录轴的显示标签
//                    "前后足区域比(%)", //数值的显示标签
//                    dateSet, //数据
//                    PlotOrientation.VERTICAL, //图标方向:水平/垂直
//                    true,  //是否显示图例
//                    false, //是否生成工具
//                    false); //是否生成URL链接
//
//            LegendTitle legend = chart.getLegend(); // 图例
//            legend.setItemFont(new Font("黑体", Font.BOLD, 20));
//
//            CategoryPlot categoryPlot = chart.getCategoryPlot();//图部分
//            categoryPlot.setBackgroundPaint(ChartColor.WHITE); // 设置图的背景颜色
//            chart.getLegend().setItemFont( new Font("黑体",Font.BOLD,20));//图标字体
//            CategoryAxis domainAxis = categoryPlot.getDomainAxis();//X轴
//
//            domainAxis.setCategoryLabelPositions(CategoryLabelPositions.STANDARD);//X轴下标  90°显示
//            domainAxis.setMaximumCategoryLabelLines(10);//自动换行    最多显示多少行
//            domainAxis.setLabelFont(new Font("黑体",Font.BOLD,20));//下标
//            domainAxis.setTickLabelFont(new Font("宋体",Font.BOLD,20));//X轴标题
//            domainAxis.setAxisLineVisible(true);
//
//            ValueAxis rangeAxis = categoryPlot.getRangeAxis();//Y轴
//            rangeAxis.setLabelFont(new Font("黑体",Font.BOLD,20));//下标
//            rangeAxis.setTickLabelFont(new Font("宋体",Font.BOLD,20));//Y轴标题
//            rangeAxis.setLowerMargin(0); // 纵轴与底部的距离
//            rangeAxis.setAxisLineVisible(true);
//
//            NumberAxis numberAxis = (NumberAxis) categoryPlot.getRangeAxis();
//            numberAxis.setAutoTickUnitSelection(false); // 是否自动设置Y轴刻度
//            numberAxis.setTickUnit(new NumberTickUnit(10));//刻度大小
//            numberAxis.setAutoRangeStickyZero(true);//和下面一行搭配使用   设置Y轴都是正数
//            numberAxis.setRangeType(RangeType.POSITIVE);
//            numberAxis.setNumberFormatOverride(new DecimalFormat("#"));//设置Y轴上的数值精度
//            numberAxis.setRangeWithMargins(0, 100);
//
//            BarRenderer renderer = (BarRenderer) categoryPlot.getRenderer();//图形修改
//            renderer.setItemMargin(0);//设置柱子之间的距离
//            renderer.setPositiveItemLabelPositionFallback(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER));
//            renderer.setDrawBarOutline(false);
//            renderer.setMaximumBarWidth(0.3); //设置柱子宽度
//            renderer.setMinimumBarLength(0); //设置柱子高度
//            renderer.setSeriesPaint(0, Color.decode("#EC5F74")); // 设置柱子的颜色
//            renderer.setSeriesPaint(1, Color.decode("#56CA95"));  // 设置柱子的颜色
//
//            renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}%" , NumberFormat.getInstance())); // 设置数值显示,格式是百分比
//            renderer.setBaseItemLabelsVisible(true);
//            renderer.setBaseItemLabelFont(new Font("黑体",Font.BOLD,20));
//            renderer.setBaseItemLabelPaint(ChartColor.BLACK);

            File file = new File(this.tempImageDir);
            if (!file.exists()) file.mkdir();
            String rightForeHindPath = this.tempImageDir + File.separator + "foreHind.jpg";
            fos = new FileOutputStream(rightForeHindPath);
            ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        } finally {
            try {
                if (fos!=null) fos.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    /**
     * 生成另一前足区域比图
     * @param featureData
     * @param width
     * @param height
     * @return
     */
    private boolean generateOtherForeFoot(FeatureData featureData, int width, int height) {
        FileOutputStream fos = null;
        try {

            List<String> leftPressureList = new ArrayList<>();
            leftPressureList.add(featureData.getPressureMeanLeft1());
            leftPressureList.add(featureData.getPressureMeanLeft2());
            leftPressureList.add(featureData.getPressureMeanLeft3());
            leftPressureList.add(featureData.getPressureMeanLeft4());
            leftPressureList.add(featureData.getPressureMeanLeft5());
            leftPressureList.add(featureData.getPressureMeanLeft6());
            leftPressureList.add(featureData.getPressureMeanLeft7());
            leftPressureList.add(featureData.getPressureMeanLeft8());
            leftPressureList.add(featureData.getPressureMeanLeft9());

            List<String> rightPressureList = new ArrayList<>();
            rightPressureList.add(featureData.getPressureMeanRigh1());
            rightPressureList.add(featureData.getPressureMeanRight2());
            rightPressureList.add(featureData.getPressureMeanRight3());
            rightPressureList.add(featureData.getPressureMeanRight4());
            rightPressureList.add(featureData.getPressureMeanRight5());
            rightPressureList.add(featureData.getPressureMeanRight6());
            rightPressureList.add(featureData.getPressureMeanRight7());
            rightPressureList.add(featureData.getPressureMeanRight8());
            rightPressureList.add(featureData.getPressureMeanRight9());

            double otherForePressureValue_left = Double.parseDouble(leftPressureList.get(0)) + Double.parseDouble(leftPressureList.get(1)) + Double.parseDouble(leftPressureList.get(7)) + Double.parseDouble(leftPressureList.get(8));
            double otherForePressureValue_right = Double.parseDouble(rightPressureList.get(0)) + Double.parseDouble(rightPressureList.get(1)) + Double.parseDouble(rightPressureList.get(7)) + Double.parseDouble(rightPressureList.get(8));

            double percentage_left = NumberUtil.div(otherForePressureValue_left, otherForePressureValue_left + otherForePressureValue_right, 3);
            double percentage_right = NumberUtil.div(otherForePressureValue_right, otherForePressureValue_left + otherForePressureValue_right, 3);
            double real_percentage_left = NumberUtil.mul(percentage_left, 100);
            double real_percentage_right = NumberUtil.mul(percentage_right, 100);

            pictureData.put("offset_fore2_left", percentage_left);
            pictureData.put("offset_fore2_right", percentage_right);

            DefaultPieDataset dateSet = new DefaultPieDataset();
            dateSet.setValue("左足", real_percentage_left);
            dateSet.setValue("右足", real_percentage_right);

            JFreeChart chart = ChartFactory.createRingChart(null,  //标题
                    dateSet,
                    false,
                    false,
                    false);

            chart.setBackgroundPaint(new GradientPaint(0, 0, new Color(255, 255, 255),
                    428,428,new Color(255, 255, 255)));
            chart.setBackgroundImageAlpha(0.8f);
            chart.setTextAntiAlias(false);

            RingPlot ringPlot =(RingPlot)chart.getPlot();

            ringPlot.setLabelFont(new Font("微软雅黑", Font.PLAIN, 20));
            ringPlot.setLabelGap(0.02D);
            ringPlot.setLabelBackgroundPaint(Color.white);
            ringPlot.setLabelOutlinePaint(Color.white);
            ringPlot.setMaximumLabelWidth(0.1D);

            //下面设置的是:饼图里面的百分比去除标签边框,只显示百分比的数据 (4个都要设置,缺一不可)
            ringPlot.setLabelOutlinePaint(null);// (1)自定义标签产生器,设置绘图面板外边的填充颜色
            ringPlot.setLabelShadowPaint(null);//自定义标签产生器, 设置绘图面板阴影的填充颜色
            ringPlot.setLabelOutlineStroke(null);//(2) 自定义标签产生器,设置绘图面板外边的填充颜色
            ringPlot.setLabelBackgroundPaint(null);//自定义标签产生器,背景色
            //上面设置的是:饼图里面的百分比去除标签边框,只显示百分比的数据

            ringPlot.setCircular(true);
            ringPlot.setOutlinePaint(Color.white);
            ringPlot.setOutlineStroke(new BasicStroke(10));
            ringPlot.setSectionOutlinesVisible(false);
            ringPlot.setBackgroundPaint(Color.white);
            ringPlot.setSeparatorsVisible(false);

            //设置开始角度
            ringPlot.setStartAngle(90D);
            //设置为顺时针方向
            ringPlot.setDirection(Rotation.CLOCKWISE);
            //设置透明度， 0.5F为半透明，1为不透明，0为全透明
            ringPlot.setForegroundAlpha(0.9f);
            ringPlot.setShadowPaint(null);

            //设置每部分颜色
            ringPlot.setSectionPaint("左足", Color.decode("#EC5F74"));
            ringPlot.setSectionPaint("右足", Color.decode("#56CA95"));
            // 设置深度，即带颜色圆环的宽度
            ringPlot.setSectionDepth(0.35d);

            DecimalFormat df = new DecimalFormat("0.0%");
            NumberFormat nf = NumberFormat.getNumberInstance();
            StandardPieSectionLabelGenerator sp = new StandardPieSectionLabelGenerator("{2}", nf, df);
            ringPlot.setLabelGenerator(sp);

//            DefaultCategoryDataset dateSet = new DefaultCategoryDataset();
//            dateSet.setValue(real_percentage_left, "左脚", "");
//            dateSet.setValue(real_percentage_right, "右脚", "");
//
//            JFreeChart chart = ChartFactory.createBarChart(null, //标题
//                    null, //目录轴的显示标签
//                    "前足区域比(%)", //数值的显示标签
//                    dateSet, //数据
//                    PlotOrientation.VERTICAL, //图标方向:水平/垂直
//                    true,  //是否显示图例
//                    false, //是否生成工具
//                    false); //是否生成URL链接
//
//            LegendTitle legend = chart.getLegend(); // 图例
//            legend.setItemFont(new Font("黑体", Font.BOLD, 20));
//
//            CategoryPlot categoryPlot = chart.getCategoryPlot();//图部分
//            categoryPlot.setBackgroundPaint(ChartColor.WHITE); // 设置图的背景颜色
//            chart.getLegend().setItemFont( new Font("黑体",Font.BOLD,20));//图标字体
//            CategoryAxis domainAxis = categoryPlot.getDomainAxis();//X轴
//
//            domainAxis.setCategoryLabelPositions(CategoryLabelPositions.STANDARD);//X轴下标  90°显示
//            domainAxis.setMaximumCategoryLabelLines(10);//自动换行    最多显示多少行
//            domainAxis.setLabelFont(new Font("黑体",Font.BOLD,20));//下标
//            domainAxis.setTickLabelFont(new Font("宋体",Font.BOLD,20));//X轴标题
//            domainAxis.setAxisLineVisible(true);
//
//            ValueAxis rangeAxis = categoryPlot.getRangeAxis();//Y轴
//            rangeAxis.setLabelFont(new Font("黑体",Font.BOLD,20));//下标
//            rangeAxis.setTickLabelFont(new Font("宋体",Font.BOLD,20));//Y轴标题
//            rangeAxis.setLowerMargin(0); // 纵轴与底部的距离
//            rangeAxis.setAxisLineVisible(true);
//
//            NumberAxis numberAxis = (NumberAxis) categoryPlot.getRangeAxis();
//            numberAxis.setAutoTickUnitSelection(false); // 是否自动设置Y轴刻度
//            numberAxis.setTickUnit(new NumberTickUnit(10));//刻度大小
//            numberAxis.setAutoRangeStickyZero(true);//和下面一行搭配使用   设置Y轴都是正数
//            numberAxis.setRangeType(RangeType.POSITIVE);
//            numberAxis.setNumberFormatOverride(new DecimalFormat("#"));//设置Y轴上的数值精度
//            numberAxis.setRangeWithMargins(0, 100);
//
//            BarRenderer renderer = (BarRenderer) categoryPlot.getRenderer();//图形修改
//            renderer.setItemMargin(0);//设置柱子之间的距离
//            renderer.setPositiveItemLabelPositionFallback(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER));
//            renderer.setDrawBarOutline(false);
//            renderer.setMaximumBarWidth(0.3); //设置柱子宽度
//            renderer.setMinimumBarLength(0); //设置柱子高度
//            renderer.setSeriesPaint(0, Color.decode("#EC5F74")); // 设置柱子的颜色
//            renderer.setSeriesPaint(1, Color.decode("#56CA95"));  // 设置柱子的颜色
//
//            renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}%" , NumberFormat.getInstance())); // 设置数值显示,格式是百分比
//            renderer.setBaseItemLabelsVisible(true);
//            renderer.setBaseItemLabelFont(new Font("黑体",Font.BOLD,20));
//            renderer.setBaseItemLabelPaint(ChartColor.BLACK);

            File file = new File(this.tempImageDir);
            if (!file.exists()) file.mkdir();
            String otherForeFootPath = this.tempImageDir + File.separator + "otherForeFoot.jpg";
            fos = new FileOutputStream(otherForeFootPath);
            ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        } finally {
            try {
                if (fos!=null) fos.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    /**
     * 生成另一后足区域比图   "otherHindFoot.jpg"
     * @param featureData
     * @param width
     * @param height
     * @return
     */
    private boolean generateOtherHindFoot(FeatureData featureData, int width, int height) {
        FileOutputStream fos = null;
        try {

            List<String> leftPressureList = new ArrayList<>();
            leftPressureList.add(featureData.getPressureMeanLeft1());
            leftPressureList.add(featureData.getPressureMeanLeft2());
            leftPressureList.add(featureData.getPressureMeanLeft3());
            leftPressureList.add(featureData.getPressureMeanLeft4());
            leftPressureList.add(featureData.getPressureMeanLeft5());
            leftPressureList.add(featureData.getPressureMeanLeft6());
            leftPressureList.add(featureData.getPressureMeanLeft7());
            leftPressureList.add(featureData.getPressureMeanLeft8());
            leftPressureList.add(featureData.getPressureMeanLeft9());

            List<String> rightPressureList = new ArrayList<>();
            rightPressureList.add(featureData.getPressureMeanRigh1());
            rightPressureList.add(featureData.getPressureMeanRight2());
            rightPressureList.add(featureData.getPressureMeanRight3());
            rightPressureList.add(featureData.getPressureMeanRight4());
            rightPressureList.add(featureData.getPressureMeanRight5());
            rightPressureList.add(featureData.getPressureMeanRight6());
            rightPressureList.add(featureData.getPressureMeanRight7());
            rightPressureList.add(featureData.getPressureMeanRight8());
            rightPressureList.add(featureData.getPressureMeanRight9());

            double otherHindPressureValue_left = Double.parseDouble(leftPressureList.get(3)) + Double.parseDouble(leftPressureList.get(4)) + Double.parseDouble(leftPressureList.get(5));
            double otherHindPressureValue_right = Double.parseDouble(rightPressureList.get(3)) + Double.parseDouble(rightPressureList.get(4)) + Double.parseDouble(rightPressureList.get(5));

            double percentage_left = NumberUtil.div(otherHindPressureValue_left, otherHindPressureValue_left + otherHindPressureValue_right, 3);
            double percentage_right = NumberUtil.div(otherHindPressureValue_right, otherHindPressureValue_left + otherHindPressureValue_right, 3);
            double real_percentage_left = NumberUtil.mul(percentage_left, 100);
            double real_percentage_right = NumberUtil.mul(percentage_right, 100);

            pictureData.put("otherHind_left", percentage_left);
            pictureData.put("otherHind_right", percentage_right);

            DefaultPieDataset dateSet = new DefaultPieDataset();
            dateSet.setValue("左足", real_percentage_left);
            dateSet.setValue("右足", real_percentage_right);

            JFreeChart chart = ChartFactory.createRingChart(null,  //标题
                    dateSet,
                    false,
                    false,
                    false);

            chart.setBackgroundPaint(new GradientPaint(0, 0, new Color(255, 255, 255),
                    428,428,new Color(255, 255, 255)));
            chart.setBackgroundImageAlpha(0.8f);
            chart.setTextAntiAlias(false);

            RingPlot ringPlot =(RingPlot)chart.getPlot();

            ringPlot.setLabelFont(new Font("微软雅黑", Font.PLAIN, 20));
            ringPlot.setLabelGap(0.02D);
            ringPlot.setLabelBackgroundPaint(Color.white);
            ringPlot.setLabelOutlinePaint(Color.white);
            ringPlot.setMaximumLabelWidth(0.1D);

            //下面设置的是:饼图里面的百分比去除标签边框,只显示百分比的数据 (4个都要设置,缺一不可)
            ringPlot.setLabelOutlinePaint(null);// (1)自定义标签产生器,设置绘图面板外边的填充颜色
            ringPlot.setLabelShadowPaint(null);//自定义标签产生器, 设置绘图面板阴影的填充颜色
            ringPlot.setLabelOutlineStroke(null);//(2) 自定义标签产生器,设置绘图面板外边的填充颜色
            ringPlot.setLabelBackgroundPaint(null);//自定义标签产生器,背景色
            //上面设置的是:饼图里面的百分比去除标签边框,只显示百分比的数据

            ringPlot.setCircular(true);
            ringPlot.setOutlinePaint(Color.white);
            ringPlot.setOutlineStroke(new BasicStroke(10));
            ringPlot.setSectionOutlinesVisible(false);
            ringPlot.setBackgroundPaint(Color.white);
            ringPlot.setSeparatorsVisible(false);

            //设置开始角度
            ringPlot.setStartAngle(90D);
            //设置为顺时针方向
            ringPlot.setDirection(Rotation.CLOCKWISE);
            //设置透明度， 0.5F为半透明，1为不透明，0为全透明
            ringPlot.setForegroundAlpha(0.9f);
            ringPlot.setShadowPaint(null);

            //设置每部分颜色
            ringPlot.setSectionPaint("左足", Color.decode("#EC5F74"));
            ringPlot.setSectionPaint("右足", Color.decode("#56CA95"));
            // 设置深度，即带颜色圆环的宽度
            ringPlot.setSectionDepth(0.35d);

            DecimalFormat df = new DecimalFormat("0.0%");
            NumberFormat nf = NumberFormat.getNumberInstance();
            StandardPieSectionLabelGenerator sp = new StandardPieSectionLabelGenerator("{2}", nf, df);
            ringPlot.setLabelGenerator(sp);

//            DefaultCategoryDataset dateSet = new DefaultCategoryDataset();
//            dateSet.setValue(real_percentage_left, "左脚", "");
//            dateSet.setValue(real_percentage_right, "右脚", "");
//
//            JFreeChart chart = ChartFactory.createBarChart(null, //标题
//                    null, //目录轴的显示标签
//                    "后足区域比(%)", //数值的显示标签
//                    dateSet, //数据
//                    PlotOrientation.VERTICAL, //图标方向:水平/垂直
//                    true,  //是否显示图例
//                    false, //是否生成工具
//                    false); //是否生成URL链接
//
//            LegendTitle legend = chart.getLegend(); // 图例
//            legend.setItemFont(new Font("黑体", Font.BOLD, 20));
//
//            CategoryPlot categoryPlot = chart.getCategoryPlot();//图部分
//            categoryPlot.setBackgroundPaint(ChartColor.WHITE); // 设置图的背景颜色
//            chart.getLegend().setItemFont( new Font("黑体",Font.BOLD,20));//图标字体
//            CategoryAxis domainAxis = categoryPlot.getDomainAxis();//X轴
//
//            domainAxis.setCategoryLabelPositions(CategoryLabelPositions.STANDARD);//X轴下标  90°显示
//            domainAxis.setMaximumCategoryLabelLines(10);//自动换行    最多显示多少行
//            domainAxis.setLabelFont(new Font("黑体",Font.BOLD,20));//下标
//            domainAxis.setTickLabelFont(new Font("宋体",Font.BOLD,20));//X轴标题
//            domainAxis.setAxisLineVisible(true);
//
//            ValueAxis rangeAxis = categoryPlot.getRangeAxis();//Y轴
//            rangeAxis.setLabelFont(new Font("黑体",Font.BOLD,20));//下标
//            rangeAxis.setTickLabelFont(new Font("宋体",Font.BOLD,20));//Y轴标题
//            rangeAxis.setLowerMargin(0); // 纵轴与底部的距离
//            rangeAxis.setAxisLineVisible(true);
//
//            NumberAxis numberAxis = (NumberAxis) categoryPlot.getRangeAxis();
//            numberAxis.setAutoTickUnitSelection(false); // 是否自动设置Y轴刻度
//            numberAxis.setTickUnit(new NumberTickUnit(10));//刻度大小
//            numberAxis.setAutoRangeStickyZero(true);//和下面一行搭配使用   设置Y轴都是正数
//            numberAxis.setRangeType(RangeType.POSITIVE);
//            numberAxis.setNumberFormatOverride(new DecimalFormat("#"));//设置Y轴上的数值精度
//            numberAxis.setRangeWithMargins(0, 100);
//
//            BarRenderer renderer = (BarRenderer) categoryPlot.getRenderer();//图形修改
//            renderer.setItemMargin(0);//设置柱子之间的距离
//            renderer.setPositiveItemLabelPositionFallback(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER));
//            renderer.setDrawBarOutline(false);
//            renderer.setMaximumBarWidth(0.3); //设置柱子宽度
//            renderer.setMinimumBarLength(0); //设置柱子高度
//            renderer.setSeriesPaint(0, Color.decode("#EC5F74")); // 设置柱子的颜色
//            renderer.setSeriesPaint(1, Color.decode("#56CA95"));  // 设置柱子的颜色
//
//            renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}%" , NumberFormat.getInstance())); // 设置数值显示,格式是百分比
//            renderer.setBaseItemLabelsVisible(true);
//            renderer.setBaseItemLabelFont(new Font("黑体",Font.BOLD,20));
//            renderer.setBaseItemLabelPaint(ChartColor.BLACK);

            File file = new File(this.tempImageDir);
            if (!file.exists()) file.mkdir();
            String otherForeFootPath = this.tempImageDir + File.separator + "otherHindFoot.jpg";
            fos = new FileOutputStream(otherForeFootPath);
            ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        } finally {
            try {
                if (fos!=null) fos.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    /**
     * 生成内侧区域比图   "inside.jpg"
     * @param featureData
     * @param width
     * @param height
     * @return
     */
    private boolean generateInsideImage(FeatureData featureData, int width, int height) {
        FileOutputStream fos = null;
        try {

            List<String> leftPressureList = new ArrayList<>();
            leftPressureList.add(featureData.getPressureMeanLeft1());
            leftPressureList.add(featureData.getPressureMeanLeft2());
            leftPressureList.add(featureData.getPressureMeanLeft3());
            leftPressureList.add(featureData.getPressureMeanLeft4());
            leftPressureList.add(featureData.getPressureMeanLeft5());
            leftPressureList.add(featureData.getPressureMeanLeft6());
            leftPressureList.add(featureData.getPressureMeanLeft7());
            leftPressureList.add(featureData.getPressureMeanLeft8());
            leftPressureList.add(featureData.getPressureMeanLeft9());

            List<String> rightPressureList = new ArrayList<>();
            rightPressureList.add(featureData.getPressureMeanRigh1());
            rightPressureList.add(featureData.getPressureMeanRight2());
            rightPressureList.add(featureData.getPressureMeanRight3());
            rightPressureList.add(featureData.getPressureMeanRight4());
            rightPressureList.add(featureData.getPressureMeanRight5());
            rightPressureList.add(featureData.getPressureMeanRight6());
            rightPressureList.add(featureData.getPressureMeanRight7());
            rightPressureList.add(featureData.getPressureMeanRight8());
            rightPressureList.add(featureData.getPressureMeanRight9());

            double insidePressureValue_left = Double.parseDouble(leftPressureList.get(0)) + Double.parseDouble(leftPressureList.get(1)) + Double.parseDouble(leftPressureList.get(2)) + Double.parseDouble(leftPressureList.get(3));
            double insidePressureValue_right = Double.parseDouble(rightPressureList.get(0)) + Double.parseDouble(rightPressureList.get(1)) + Double.parseDouble(rightPressureList.get(2)) + Double.parseDouble(rightPressureList.get(3));

            double percentage_left = NumberUtil.div(insidePressureValue_left, insidePressureValue_left + insidePressureValue_right, 3);
            double percentage_right = NumberUtil.div(insidePressureValue_right, insidePressureValue_left + insidePressureValue_right, 3);
            double real_percentage_left = NumberUtil.mul(percentage_left, 100);
            double real_percentage_right = NumberUtil.mul(percentage_right, 100);

            pictureData.put("offset_inside_left", percentage_left);
            pictureData.put("offset_inside_right", percentage_right);

            DefaultCategoryDataset dateSet = new DefaultCategoryDataset();
            dateSet.setValue(real_percentage_left, "左脚", "");
            dateSet.setValue(real_percentage_right, "右脚", "");

            JFreeChart chart = ChartFactory.createBarChart(null, //标题
                    null, //目录轴的显示标签
                    null, //数值的显示标签
                    dateSet, //数据
                    PlotOrientation.VERTICAL, //图标方向:水平/垂直
                    false,  //是否显示图例
                    false, //是否生成工具
                    false); //是否生成URL链接

//            LegendTitle legend = chart.getLegend(); // 图例
//            legend.setItemFont(new Font("黑体", Font.BOLD, 20));

            CategoryPlot categoryPlot = chart.getCategoryPlot();//图部分
            categoryPlot.setBackgroundPaint(ChartColor.WHITE); // 设置图的背景颜色
//            chart.getLegend().setItemFont( new Font("黑体",Font.BOLD,20));//图标字体

            CategoryAxis domainAxis = categoryPlot.getDomainAxis();//X轴
            domainAxis.setCategoryLabelPositions(CategoryLabelPositions.STANDARD);//X轴下标  90°显示
            domainAxis.setMaximumCategoryLabelLines(10);//自动换行    最多显示多少行
            domainAxis.setLabelFont(new Font("黑体",Font.BOLD,20));//下标
            domainAxis.setTickLabelFont(new Font("宋体",Font.BOLD,20));//X轴标题
            domainAxis.setAxisLineVisible(false);

            ValueAxis rangeAxis = categoryPlot.getRangeAxis();//Y轴
            rangeAxis.setLabelFont(new Font("黑体",Font.BOLD,20));//下标
            rangeAxis.setTickLabelFont(new Font("宋体",Font.BOLD,20));//Y轴标题
            rangeAxis.setLowerMargin(0); // 纵轴与底部的距离
            rangeAxis.setAxisLineVisible(false);

            NumberAxis numberAxis = (NumberAxis) categoryPlot.getRangeAxis();
            numberAxis.setAutoTickUnitSelection(false); // 是否自动设置Y轴刻度
            numberAxis.setTickUnit(new NumberTickUnit(10));//刻度大小
            numberAxis.setAutoRangeStickyZero(true);//和下面一行搭配使用   设置Y轴都是正数
            numberAxis.setRangeType(RangeType.POSITIVE);
            numberAxis.setNumberFormatOverride(new DecimalFormat("#"));//设置Y轴上的数值精度
            numberAxis.setRangeWithMargins(0, 100);

            BarRenderer renderer = (BarRenderer) categoryPlot.getRenderer();//图形修改
            renderer.setItemMargin(0);//设置柱子之间的距离
            renderer.setPositiveItemLabelPositionFallback(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER));
            renderer.setDrawBarOutline(false);
            renderer.setMaximumBarWidth(0.2); //设置柱子宽度
            renderer.setMinimumBarLength(0); //设置柱子高度
            renderer.setSeriesPaint(0, Color.decode("#EC5F74")); // 设置柱子的颜色
            renderer.setSeriesPaint(1, Color.decode("#56CA95"));  // 设置柱子的颜色

            renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}%" , NumberFormat.getInstance())); // 设置数值显示,格式是百分比
            renderer.setBaseItemLabelsVisible(true);
            renderer.setBaseItemLabelFont(new Font("黑体",Font.BOLD,20));
            renderer.setBaseItemLabelPaint(ChartColor.BLACK);

            File file = new File(this.tempImageDir);
            if (!file.exists()) file.mkdir();
            String insidePath = this.tempImageDir + File.separator + "inside.jpg";
            fos = new FileOutputStream(insidePath);
            ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        } finally {
            try {
                if (fos!=null) fos.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    /**
     * 生成外侧区域比图   "outside.jpg"
     * @param featureData
     * @param width
     * @param height
     * @return
     */
    private boolean generateOutsideImage(FeatureData featureData, int width, int height) {
        FileOutputStream fos = null;
        try {

            List<String> leftPressureList = new ArrayList<>();
            leftPressureList.add(featureData.getPressureMeanLeft1());
            leftPressureList.add(featureData.getPressureMeanLeft2());
            leftPressureList.add(featureData.getPressureMeanLeft3());
            leftPressureList.add(featureData.getPressureMeanLeft4());
            leftPressureList.add(featureData.getPressureMeanLeft5());
            leftPressureList.add(featureData.getPressureMeanLeft6());
            leftPressureList.add(featureData.getPressureMeanLeft7());
            leftPressureList.add(featureData.getPressureMeanLeft8());
            leftPressureList.add(featureData.getPressureMeanLeft9());

            List<String> rightPressureList = new ArrayList<>();
            rightPressureList.add(featureData.getPressureMeanRigh1());
            rightPressureList.add(featureData.getPressureMeanRight2());
            rightPressureList.add(featureData.getPressureMeanRight3());
            rightPressureList.add(featureData.getPressureMeanRight4());
            rightPressureList.add(featureData.getPressureMeanRight5());
            rightPressureList.add(featureData.getPressureMeanRight6());
            rightPressureList.add(featureData.getPressureMeanRight7());
            rightPressureList.add(featureData.getPressureMeanRight8());
            rightPressureList.add(featureData.getPressureMeanRight9());
            double outsidePressureValue_left = Double.parseDouble(leftPressureList.get(5)) + Double.parseDouble(leftPressureList.get(6)) + Double.parseDouble(leftPressureList.get(7));
            double outsidePressureValue_right = Double.parseDouble(rightPressureList.get(5)) + Double.parseDouble(rightPressureList.get(6)) + Double.parseDouble(rightPressureList.get(7));

            double percentage_left = NumberUtil.div(outsidePressureValue_left, outsidePressureValue_left + outsidePressureValue_right, 3);
            double percentage_right = NumberUtil.div(outsidePressureValue_right, outsidePressureValue_left + outsidePressureValue_right, 3);
            double real_percentage_left = NumberUtil.mul(percentage_left, 100);
            double real_percentage_right = NumberUtil.mul(percentage_right, 100);

            pictureData.put("offset_outside_left", percentage_left);
            pictureData.put("offset_outside_right", percentage_right);

            DefaultCategoryDataset dateSet = new DefaultCategoryDataset();
            dateSet.setValue(real_percentage_left, "左脚", "");
            dateSet.setValue(real_percentage_right, "右脚", "");

            JFreeChart chart = ChartFactory.createBarChart(null, //标题
                    null, //目录轴的显示标签
                    null, //数值的显示标签
                    dateSet, //数据
                    PlotOrientation.VERTICAL, //图标方向:水平/垂直
                    false,  //是否显示图例
                    false, //是否生成工具
                    false); //是否生成URL链接

//            LegendTitle legend = chart.getLegend(); // 图例
//            legend.setItemFont(new Font("黑体", Font.BOLD, 20));

            CategoryPlot categoryPlot = chart.getCategoryPlot();//图部分
            categoryPlot.setBackgroundPaint(ChartColor.WHITE); // 设置图的背景颜色
//            chart.getLegend().setItemFont( new Font("黑体",Font.BOLD,20));//图标字体
            CategoryAxis domainAxis = categoryPlot.getDomainAxis();//X轴

            domainAxis.setCategoryLabelPositions(CategoryLabelPositions.STANDARD);//X轴下标  90°显示
            domainAxis.setMaximumCategoryLabelLines(10);//自动换行    最多显示多少行
            domainAxis.setLabelFont(new Font("黑体",Font.BOLD,20));//下标
            domainAxis.setTickLabelFont(new Font("宋体",Font.BOLD,20));//X轴标题
            domainAxis.setAxisLineVisible(true);

            ValueAxis rangeAxis = categoryPlot.getRangeAxis();//Y轴
            rangeAxis.setLabelFont(new Font("黑体",Font.BOLD,20));//下标
            rangeAxis.setTickLabelFont(new Font("宋体",Font.BOLD,20));//Y轴标题
            rangeAxis.setLowerMargin(0); // 纵轴与底部的距离
            rangeAxis.setAxisLineVisible(true);

            NumberAxis numberAxis = (NumberAxis) categoryPlot.getRangeAxis();
            numberAxis.setAutoTickUnitSelection(false); // 是否自动设置Y轴刻度
            numberAxis.setTickUnit(new NumberTickUnit(10));//刻度大小
            numberAxis.setAutoRangeStickyZero(true);//和下面一行搭配使用   设置Y轴都是正数
            numberAxis.setRangeType(RangeType.POSITIVE);
            numberAxis.setNumberFormatOverride(new DecimalFormat("#"));//设置Y轴上的数值精度
            numberAxis.setRangeWithMargins(0, 100);

            BarRenderer renderer = (BarRenderer) categoryPlot.getRenderer();//图形修改
            renderer.setItemMargin(0);//设置柱子之间的距离
            renderer.setPositiveItemLabelPositionFallback(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER));
            renderer.setDrawBarOutline(false);
            renderer.setMaximumBarWidth(0.2); //设置柱子宽度
            renderer.setMinimumBarLength(0); //设置柱子高度
            renderer.setSeriesPaint(0, Color.decode("#EC5F74")); // 设置柱子的颜色
            renderer.setSeriesPaint(1, Color.decode("#56CA95"));  // 设置柱子的颜色

            renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}%" , NumberFormat.getInstance())); // 设置数值显示,格式是百分比
            // 设置柱子上数值的字体
            renderer.setBaseItemLabelsVisible(true);
            renderer.setBaseItemLabelFont(new Font("黑体",Font.BOLD,20));
            renderer.setBaseItemLabelPaint(ChartColor.BLACK);

            File file = new File(this.tempImageDir);
            if (!file.exists()) file.mkdir();
            String outsidePath = this.tempImageDir + File.separator + "outside.jpg";
            fos = new FileOutputStream(outsidePath);
            ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        } finally {
            try {
                if (fos!=null) fos.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    /**
     * 生成左足的内外侧区域比图   "inoutLeft.jpg"
     * @param featureData
     * @param width
     * @param height
     * @return
     */
    private boolean generateInOutLeft(FeatureData featureData, int width, int height) {
        FileOutputStream fos = null;
        try {

            List<String> leftPressureList = new ArrayList<>();
            leftPressureList.add(featureData.getPressureMeanLeft1());
            leftPressureList.add(featureData.getPressureMeanLeft2());
            leftPressureList.add(featureData.getPressureMeanLeft3());
            leftPressureList.add(featureData.getPressureMeanLeft4());
            leftPressureList.add(featureData.getPressureMeanLeft5());
            leftPressureList.add(featureData.getPressureMeanLeft6());
            leftPressureList.add(featureData.getPressureMeanLeft7());
            leftPressureList.add(featureData.getPressureMeanLeft8());
            leftPressureList.add(featureData.getPressureMeanLeft9());


            double insidePressureValue_left = Double.parseDouble(leftPressureList.get(0)) + Double.parseDouble(leftPressureList.get(1)) + Double.parseDouble(leftPressureList.get(2)) + Double.parseDouble(leftPressureList.get(3));
            double outsidePressureValue_left = Double.parseDouble(leftPressureList.get(5)) + Double.parseDouble(leftPressureList.get(6)) + Double.parseDouble(leftPressureList.get(7));

            double percentage_inside = NumberUtil.div(insidePressureValue_left, insidePressureValue_left + outsidePressureValue_left, 3);
            double percentage_outside = NumberUtil.div(outsidePressureValue_left, insidePressureValue_left + outsidePressureValue_left, 3);
            double real_percentage_inisde = NumberUtil.mul(percentage_inside, 100);
            double real_percentage_outside = NumberUtil.mul(percentage_outside, 100);

            pictureData.put("inside_left", percentage_inside);
            pictureData.put("outside_left", percentage_outside);

            DefaultCategoryDataset dateSet = new DefaultCategoryDataset();
            dateSet.setValue(real_percentage_inisde, "内侧", "");
            dateSet.setValue(real_percentage_outside, "外侧", "");

            JFreeChart chart = ChartFactory.createBarChart(null, //标题
                    null, //目录轴的显示标签
                    null, //数值的显示标签
                    dateSet, //数据
                    PlotOrientation.VERTICAL, //图标方向:水平/垂直
                    false,  //是否显示图例
                    false, //是否生成工具
                    false); //是否生成URL链接

//            LegendTitle legend = chart.getLegend(); // 图例
//            legend.setItemFont(new Font("黑体", Font.BOLD, 20));

            CategoryPlot categoryPlot = chart.getCategoryPlot();//图部分
            categoryPlot.setBackgroundPaint(ChartColor.WHITE); // 设置图的背景颜色
//            chart.getLegend().setItemFont( new Font("黑体",Font.BOLD,20));//图标字体

            CategoryAxis domainAxis = categoryPlot.getDomainAxis();//X轴
            domainAxis.setCategoryLabelPositions(CategoryLabelPositions.STANDARD);//X轴下标  90°显示
            domainAxis.setMaximumCategoryLabelLines(10);//自动换行    最多显示多少行
            domainAxis.setLabelFont(new Font("黑体",Font.BOLD,20));//下标
            domainAxis.setTickLabelFont(new Font("宋体",Font.BOLD,20));//X轴标题
            domainAxis.setAxisLineVisible(false);

            ValueAxis rangeAxis = categoryPlot.getRangeAxis();//Y轴
            rangeAxis.setLabelFont(new Font("黑体",Font.BOLD,20));//下标
            rangeAxis.setTickLabelFont(new Font("宋体",Font.BOLD,20));//Y轴标题
            rangeAxis.setLowerMargin(0); // 纵轴与底部的距离
            rangeAxis.setAxisLineVisible(false);

            NumberAxis numberAxis = (NumberAxis) categoryPlot.getRangeAxis();
            numberAxis.setAutoTickUnitSelection(false); // 是否自动设置Y轴刻度
            numberAxis.setTickUnit(new NumberTickUnit(10));//刻度大小
            numberAxis.setAutoRangeStickyZero(true);//和下面一行搭配使用   设置Y轴都是正数
            numberAxis.setRangeType(RangeType.POSITIVE);
            numberAxis.setNumberFormatOverride(new DecimalFormat("#"));//设置Y轴上的数值精度
            numberAxis.setRangeWithMargins(0, 100);

            BarRenderer renderer = (BarRenderer) categoryPlot.getRenderer();//图形修改
            renderer.setItemMargin(0);//设置柱子之间的距离
            renderer.setPositiveItemLabelPositionFallback(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER));
            renderer.setDrawBarOutline(false);
            renderer.setMaximumBarWidth(0.2); //设置柱子宽度
            renderer.setMinimumBarLength(0); //设置柱子高度
            renderer.setSeriesPaint(0, Color.decode("#FF9609")); // 设置柱子的颜色
            renderer.setSeriesPaint(1, Color.decode("#B0B0B0"));  // 设置柱子的颜色

            renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}%" , NumberFormat.getInstance())); // 设置数值显示,格式是百分比
            renderer.setBaseItemLabelsVisible(true);
            renderer.setBaseItemLabelFont(new Font("黑体",Font.BOLD,20));
            renderer.setBaseItemLabelPaint(ChartColor.BLACK);

            File file = new File(this.tempImageDir);
            if (!file.exists()) file.mkdir();
            String inoutLeftPath = this.tempImageDir + File.separator + "inoutLeft.jpg";
            fos = new FileOutputStream(inoutLeftPath);
            ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        } finally {
            try {
                if (fos!=null) fos.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    /**
     * 生成右足的内外侧区域比图   "inoutRight.jpg"
     * @param featureData
     * @param width
     * @param height
     * @return
     */
    private boolean generateInOutRight(FeatureData featureData, int width, int height) {
        FileOutputStream fos = null;
        try {

            List<String> rightPressureList = new ArrayList<>();
            rightPressureList.add(featureData.getPressureMeanRigh1());
            rightPressureList.add(featureData.getPressureMeanRight2());
            rightPressureList.add(featureData.getPressureMeanRight3());
            rightPressureList.add(featureData.getPressureMeanRight4());
            rightPressureList.add(featureData.getPressureMeanRight5());
            rightPressureList.add(featureData.getPressureMeanRight6());
            rightPressureList.add(featureData.getPressureMeanRight7());
            rightPressureList.add(featureData.getPressureMeanRight8());
            rightPressureList.add(featureData.getPressureMeanRight9());


            double insidePressureValue_right = Double.parseDouble(rightPressureList.get(0)) + Double.parseDouble(rightPressureList.get(1)) + Double.parseDouble(rightPressureList.get(2)) + Double.parseDouble(rightPressureList.get(3));
            double outsidePressureValue_right = Double.parseDouble(rightPressureList.get(5)) + Double.parseDouble(rightPressureList.get(6)) + Double.parseDouble(rightPressureList.get(7));

            double percentage_inside = NumberUtil.div(insidePressureValue_right, insidePressureValue_right + outsidePressureValue_right, 3);
            double percentage_outside = NumberUtil.div(outsidePressureValue_right, insidePressureValue_right + outsidePressureValue_right, 3);
            double real_percentage_inside = NumberUtil.mul(percentage_inside, 100);
            double real_percentage_outside = NumberUtil.mul(percentage_outside, 100);

            pictureData.put("inside_right", percentage_inside);
            pictureData.put("outside_right", percentage_outside);

            DefaultCategoryDataset dateSet = new DefaultCategoryDataset();
            dateSet.setValue(real_percentage_inside, "内侧", "");
            dateSet.setValue(real_percentage_outside, "外侧", "");

            JFreeChart chart = ChartFactory.createBarChart(null, //标题
                    null, //目录轴的显示标签
                    null, //数值的显示标签
                    dateSet, //数据
                    PlotOrientation.VERTICAL, //图标方向:水平/垂直
                    false,  //是否显示图例
                    false, //是否生成工具
                    false); //是否生成URL链接

//            LegendTitle legend = chart.getLegend(); // 图例
//            legend.setItemFont(new Font("黑体", Font.BOLD, 20));

            CategoryPlot categoryPlot = chart.getCategoryPlot();//图部分
            categoryPlot.setBackgroundPaint(ChartColor.WHITE); // 设置图的背景颜色
//            chart.getLegend().setItemFont( new Font("黑体",Font.BOLD,20));//图标字体
            CategoryAxis domainAxis = categoryPlot.getDomainAxis();//X轴

            domainAxis.setCategoryLabelPositions(CategoryLabelPositions.STANDARD);//X轴下标  90°显示
            domainAxis.setMaximumCategoryLabelLines(10);//自动换行    最多显示多少行
            domainAxis.setLabelFont(new Font("黑体",Font.BOLD,20));//下标
            domainAxis.setTickLabelFont(new Font("宋体",Font.BOLD,20));//X轴标题
            domainAxis.setAxisLineVisible(false);

            ValueAxis rangeAxis = categoryPlot.getRangeAxis();//Y轴
            rangeAxis.setLabelFont(new Font("黑体",Font.BOLD,20));//下标
            rangeAxis.setTickLabelFont(new Font("宋体",Font.BOLD,20));//Y轴标题
            rangeAxis.setLowerMargin(0); // 纵轴与底部的距离
            rangeAxis.setAxisLineVisible(false);

            NumberAxis numberAxis = (NumberAxis) categoryPlot.getRangeAxis();
            numberAxis.setAutoTickUnitSelection(false); // 是否自动设置Y轴刻度
            numberAxis.setTickUnit(new NumberTickUnit(10));//刻度大小
            numberAxis.setAutoRangeStickyZero(true);//和下面一行搭配使用   设置Y轴都是正数
            numberAxis.setRangeType(RangeType.POSITIVE);
            numberAxis.setNumberFormatOverride(new DecimalFormat("#"));//设置Y轴上的数值精度
            numberAxis.setRangeWithMargins(0, 100);

            BarRenderer renderer = (BarRenderer) categoryPlot.getRenderer();//图形修改
            renderer.setItemMargin(0);//设置柱子之间的距离
            renderer.setPositiveItemLabelPositionFallback(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER));
            renderer.setDrawBarOutline(false);
            renderer.setMaximumBarWidth(0.2); //设置柱子宽度
            renderer.setMinimumBarLength(0); //设置柱子高度
            renderer.setSeriesPaint(0, Color.decode("#FF9609")); // 设置柱子的颜色
            renderer.setSeriesPaint(1, Color.decode("#B0B0B0"));  // 设置柱子的颜色

            renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}%" , NumberFormat.getInstance())); // 设置数值显示,格式是百分比
            renderer.setBaseItemLabelsVisible(true);
            renderer.setBaseItemLabelFont(new Font("黑体",Font.BOLD,20));
            renderer.setBaseItemLabelPaint(ChartColor.BLACK);

            File file = new File(this.tempImageDir);
            if (!file.exists()) file.mkdir();
            String inoutRightPath = this.tempImageDir + File.separator + "inoutRight.jpg";
            fos = new FileOutputStream(inoutRightPath);
            ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        } finally {
            try {
                if (fos!=null) fos.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    /**
     * 生成内外侧区域比图   "inout.jpg"
     * @param featureData
     * @param width
     * @param height
     * @return
     */
    private boolean generateInOut(FeatureData featureData, int width, int height) {
        FileOutputStream fos = null;
        try {
            List<String> leftPressureList = new ArrayList<>();
            leftPressureList.add(featureData.getPressureMeanLeft1());
            leftPressureList.add(featureData.getPressureMeanLeft2());
            leftPressureList.add(featureData.getPressureMeanLeft3());
            leftPressureList.add(featureData.getPressureMeanLeft4());
            leftPressureList.add(featureData.getPressureMeanLeft5());
            leftPressureList.add(featureData.getPressureMeanLeft6());
            leftPressureList.add(featureData.getPressureMeanLeft7());
            leftPressureList.add(featureData.getPressureMeanLeft8());
            leftPressureList.add(featureData.getPressureMeanLeft9());

            List<String> rightPressureList = new ArrayList<>();
            rightPressureList.add(featureData.getPressureMeanRigh1());
            rightPressureList.add(featureData.getPressureMeanRight2());
            rightPressureList.add(featureData.getPressureMeanRight3());
            rightPressureList.add(featureData.getPressureMeanRight4());
            rightPressureList.add(featureData.getPressureMeanRight5());
            rightPressureList.add(featureData.getPressureMeanRight6());
            rightPressureList.add(featureData.getPressureMeanRight7());
            rightPressureList.add(featureData.getPressureMeanRight8());
            rightPressureList.add(featureData.getPressureMeanRight9());


            double insidePressureValue = Double.parseDouble(rightPressureList.get(0)) + Double.parseDouble(rightPressureList.get(1)) + Double.parseDouble(rightPressureList.get(2)) + Double.parseDouble(rightPressureList.get(3)) +
                                         Double.parseDouble(leftPressureList.get(0)) + Double.parseDouble(leftPressureList.get(1)) + Double.parseDouble(leftPressureList.get(2)) + Double.parseDouble(leftPressureList.get(3));
            double outsidePressureValue = Double.parseDouble(rightPressureList.get(5)) + Double.parseDouble(rightPressureList.get(6)) + Double.parseDouble(rightPressureList.get(7)) +
                                          Double.parseDouble(leftPressureList.get(5)) + Double.parseDouble(leftPressureList.get(6)) + Double.parseDouble(leftPressureList.get(7));

            double percentage_inside = NumberUtil.div(insidePressureValue, insidePressureValue + outsidePressureValue, 3);
            double percentage_outside = NumberUtil.div(outsidePressureValue, insidePressureValue + outsidePressureValue, 3);
            double real_percentage_inside = NumberUtil.mul(percentage_inside, 100);
            double real_percentage_outside = NumberUtil.mul(percentage_outside, 100);

            pictureData.put("inside", percentage_inside);
            pictureData.put("outside", percentage_outside);

            DefaultCategoryDataset dateSet = new DefaultCategoryDataset();
            dateSet.setValue(real_percentage_inside, "内侧", "");
            dateSet.setValue(real_percentage_outside, "外侧", "");

            JFreeChart chart = ChartFactory.createBarChart(null, //标题
                    null, //目录轴的显示标签
                    null, //数值的显示标签
                    dateSet, //数据
                    PlotOrientation.VERTICAL, //图标方向:水平/垂直
                    false,  //是否显示图例
                    false, //是否生成工具
                    false); //是否生成URL链接

//            LegendTitle legend = chart.getLegend(); // 图例
//            legend.setItemFont(new Font("黑体", Font.BOLD, 20));

            CategoryPlot categoryPlot = chart.getCategoryPlot();//图部分
            categoryPlot.setBackgroundPaint(ChartColor.WHITE); // 设置图的背景颜色
//            chart.getLegend().setItemFont( new Font("黑体",Font.BOLD,20));//图标字体
            CategoryAxis domainAxis = categoryPlot.getDomainAxis();//X轴

            domainAxis.setCategoryLabelPositions(CategoryLabelPositions.STANDARD);//X轴下标  90°显示
            domainAxis.setMaximumCategoryLabelLines(10);//自动换行    最多显示多少行
            domainAxis.setLabelFont(new Font("黑体",Font.BOLD,20));//下标
            domainAxis.setTickLabelFont(new Font("宋体",Font.BOLD,20));//X轴标题
            domainAxis.setAxisLineVisible(false);

            ValueAxis rangeAxis = categoryPlot.getRangeAxis();//Y轴
            rangeAxis.setLabelFont(new Font("黑体",Font.BOLD,20));//下标
            rangeAxis.setTickLabelFont(new Font("宋体",Font.BOLD,20));//Y轴标题
            rangeAxis.setLowerMargin(0); // 纵轴与底部的距离
            rangeAxis.setAxisLineVisible(false);

            NumberAxis numberAxis = (NumberAxis) categoryPlot.getRangeAxis();
            numberAxis.setAutoTickUnitSelection(false); // 是否自动设置Y轴刻度
            numberAxis.setTickUnit(new NumberTickUnit(10));//刻度大小
            numberAxis.setAutoRangeStickyZero(true);//和下面一行搭配使用   设置Y轴都是正数
            numberAxis.setRangeType(RangeType.POSITIVE);
            numberAxis.setNumberFormatOverride(new DecimalFormat("#"));//设置Y轴上的数值精度
            numberAxis.setRangeWithMargins(0, 100);

            BarRenderer renderer = (BarRenderer) categoryPlot.getRenderer();//图形修改
            renderer.setItemMargin(0);//设置柱子之间的距离
            renderer.setPositiveItemLabelPositionFallback(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER));
            renderer.setDrawBarOutline(false);
            renderer.setMaximumBarWidth(0.2); //设置柱子宽度
            renderer.setMinimumBarLength(0); //设置柱子高度
            renderer.setSeriesPaint(0, Color.decode("#FF9609")); // 设置柱子的颜色
            renderer.setSeriesPaint(1, Color.decode("#B0B0B0"));  // 设置柱子的颜色

            renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}%" , NumberFormat.getInstance())); // 设置数值显示,格式是百分比
            renderer.setBaseItemLabelsVisible(true);
            renderer.setBaseItemLabelFont(new Font("黑体",Font.BOLD,20));
            renderer.setBaseItemLabelPaint(ChartColor.BLACK);

            File file = new File(this.tempImageDir);
            if (!file.exists()) file.mkdir();
            String inoutPath = this.tempImageDir + File.separator + "inout.jpg";
            fos = new FileOutputStream(inoutPath);
            ChartUtilities.writeChartAsJPEG(fos, chart, width, height);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        } finally {
            try {
                if (fos!=null) fos.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    /**
     * 保留2位小数
     * @param numStr
     * @return
     */
    private Double getTwoDigits(String numStr) {
        if(numStr==null || numStr.equals("") ) return null;
        return NumberUtil.round(numStr, 2).doubleValue();
    }

    /**
     * 保留3位小数
     * @param numStr
     * @return
     */
    private Double getThreeDigits(String numStr) {
        if(numStr==null || numStr.equals("") ) return null;
        return NumberUtil.round(numStr, 3).doubleValue();
    }

    /**
     * 保留4位小数
     * @param numStr
     * @return
     */
    private Double getFourDigits(String numStr) {
        if(numStr==null || numStr.equals("") ) return null;
        return NumberUtil.round(numStr, 4).doubleValue();
    }

}
